MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / NameStyleCheck

Method NameStyleCheck

CodeFormatLib/src/LuaCodeFormat.cpp:230–258  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

228}
229
230Result<std::vector<LuaDiagnosticInfo>> LuaCodeFormat::NameStyleCheck(const std::string &uri, std::string &&text) {
231 auto file = LuaSource::From(std::move(text));
232 LuaLexer luaLexer(file);
233 if (_supportNonStandardSymbol) {
234 luaLexer.SupportNonStandardSymbol();
235 }
236 if (_supportCLikeComments) {
237 luaLexer.SupportCLikeComments();
238 }
239
240 luaLexer.Parse();
241
242 LuaParser p(file, std::move(luaLexer.GetTokens()));
243 p.Parse();
244
245 if (p.HasError()) {
246 return ResultType::Err;
247 }
248
249 LuaSyntaxTree t;
250 t.BuildTree(p);
251
252 LuaStyle style = GetStyle(uri);
253
254 DiagnosticBuilder diagnosticBuilder(style, _diagnosticStyle);
255
256 diagnosticBuilder.NameStyleCheck(t);
257 return MakeDiagnosticInfo(diagnosticBuilder.GetDiagnosticResults(t), file);
258}
259
260std::vector<SuggestItem> LuaCodeFormat::SpellCorrect(const std::string &word) {
261 std::string letterWord = word;

Callers 3

CheckSingleFileMethod · 0.45
name_style_analysisFunction · 0.45
DiagnosticMethod · 0.45

Calls 7

GetTokensMethod · 0.80
BuildTreeMethod · 0.80
GetDiagnosticResultsMethod · 0.80
SupportCLikeCommentsMethod · 0.45
ParseMethod · 0.45
HasErrorMethod · 0.45

Tested by

no test coverage detected