Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed reported position #416

Merged
merged 2 commits into from
May 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Fixed handling of `Arrow` in type names in TokenTree [#413](https://github.com/HaxeCheckstyle/haxe-checkstyle/issues/413)
- Fixed handling of `Dot` after `KwdNew` in TokenTree [#413](https://github.com/HaxeCheckstyle/haxe-checkstyle/issues/413)
- Fixed line number reported for MethodCount check [#415](https://github.com/HaxeCheckstyle/haxe-checkstyle/issues/415)
- Fixed position info for AvoidStarImport, Trace, UnnecessaryConstructor, UnusedLocalVar and UnusedImport checks [#416](https://github.com/HaxeCheckstyle/haxe-checkstyle/issues/416)
- Improved automatic detection of coding style by not stopping at the first change in number of violations [#415](https://github.com/HaxeCheckstyle/haxe-checkstyle/issues/415)
- Improved handling of file content and `class` parsing in TokenTree [#413](https://github.com/HaxeCheckstyle/haxe-checkstyle/issues/413)
- Refactored handling of internal errors (parsing and checks) [#413](https://github.com/HaxeCheckstyle/haxe-checkstyle/issues/413)
Expand Down
2 changes: 1 addition & 1 deletion src/checkstyle/checks/coding/TraceCheck.hx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class TraceCheck extends Check {
if (filterTrace(tr.parent)) continue;
if (isPosSuppressed(tr.pos)) continue;

logPos("Trace detected", tr.pos);
logPos("Trace detected", tr.getPos());
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/checkstyle/checks/coding/UnusedLocalVarCheck.hx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class UnusedLocalVarCheck extends Check {
});
if (nameList.length > 1) return;

logPos('Unused local variable $name', v.pos);
logPos('Unused local variable $name', v.parent.getPos());
}

function checkStringInterpolation(tok:TokenTree, name:String, s:String):FilterResult {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class UnnecessaryConstructorCheck extends Check {
for (token in acceptableTokens) {
if (token.filter([Kwd(KwdNew)], FIRST, 2).length > 0) {
haveConstructor = true;
constructorPos = token.pos;
constructorPos = token.getPos();
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/checkstyle/checks/imports/AvoidStarImportCheck.hx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class AvoidStarImportCheck extends Check {
for (entry in importEntries) {
var stars:Array<TokenTree> = entry.filter([Binop(OpMult)], ALL);
if (stars.length <= 0) continue;
logPos('Using the ".*" form of import should be avoided', entry.pos);
logPos('Using the ".*" form of import should be avoided', entry.getPos());
}
}

Expand Down
10 changes: 5 additions & 5 deletions src/checkstyle/checks/imports/UnusedImportCheck.hx
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,17 @@ class UnusedImportCheck extends Check {
if (ignoreModules.contains(moduleName)) continue;

if ((packageName != null) && (!hasMapping(moduleName)) && ('$packageName.$typeName' == moduleName)) {
logPos('Detected import "$moduleName" from same package "$packageName"', imp.pos);
logPos('Detected import "$moduleName" from same package "$packageName"', imp.getPos());
continue;
}

if (!~/\./.match(moduleName)) {
logPos('Unnecessary toplevel import "$moduleName" detected', imp.pos);
logPos('Unnecessary toplevel import "$moduleName" detected', imp.getPos());
continue;
}

if (seenModules.contains(moduleName)) {
logPos('Duplicate import "$moduleName" detected', imp.pos);
logPos('Duplicate import "$moduleName" detected', imp.getPos());
continue;
}
seenModules.push(moduleName);
Expand All @@ -79,7 +79,7 @@ class UnusedImportCheck extends Check {
var packageName:String = detectModuleName(packageToken[0]);
if (packageName == "") packageName = null;
if (packageToken.length > 1) {
logPos("Multiple package declarations found", packageToken[1].pos);
logPos("Multiple package declarations found", packageToken[1].getPos());
}
return packageName;
}
Expand Down Expand Up @@ -143,7 +143,7 @@ class UnusedImportCheck extends Check {
if (checkName(typeName, moduleName, name)) return;
}
}
logPos('Unused import "$moduleName" detected', importTok.pos);
logPos('Unused import "$moduleName" detected', importTok.getPos());
}

function extractLiteralNames(text:String):Array<String> {
Expand Down
2 changes: 1 addition & 1 deletion src/checkstyle/checks/size/FileLengthCheck.hx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class FileLengthCheck extends Check {
fixed: [],
properties: [{
propertyName: "max",
values: [for (i in 0...7) 800 + i * 200]
values: [for (i in 0...10) 400 + i * 200]
}]
}];
}
Expand Down