Vitalii Elenhaupt
d650ca5477
Incorrectly reporting shadowingOuterLocalVar within macro included
...
closes #161
2020-07-15 10:18:12 +03:00
Vitalii Elenhaupt
7f501a1df5
RedundantStringCoercion: do not report to_s with named args
...
closes #160
2020-06-24 09:26:03 +03:00
Vitalii Elenhaupt
c3260c1740
Move to YAML::Serializable
2020-06-15 14:29:49 +03:00
Vladislav Trotsenko
bdeb6e3391
Feature/Layout trailing lines, final newline checkup ( #152 )
2020-05-05 16:52:24 +03:00
Matheus Richard
f1adf14527
Handle duplicated files on GlobUtils ( #151 )
...
* Handle duplicated files on GlobUtils
* Update src/ameba/glob_utils.cr
Co-Authored-By: George Dietrich <yomoejoe@gmail.com>
Co-authored-by: George Dietrich <yomoejoe@gmail.com>
2020-04-19 11:52:15 +03:00
Vitalii Elenhaupt
478da94c20
Allow constants to be in PascalCase (i.e. Log, SuperConstant)
...
closes #148
2020-04-13 09:38:05 +03:00
Sijawusz Pur Rahnama
1a25583036
Make InlineComments::COMMENT_DIRECTIVE_REGEX more strict ( #146 )
2020-04-11 09:55:41 +03:00
Vitalii Elenhaupt
458c492730
Do not report shadowing outer local var is var is declared below the
...
shadowed var
closes #144
2020-04-10 10:44:42 +03:00
Vitalii Elenhaupt
99c65b5a28
New rule: Lint/BadDirective ( #143 )
...
* New rule: Lint/BadDirective
* Address PR feedback
2020-04-06 15:10:34 +03:00
Vitalii Elenhaupt
db6b54e63c
New rule: Style/IsANil
2020-03-29 19:45:13 +03:00
Vitalii Elenhaupt
04497feeed
Lint/LiteralInInterpolation: properly report node position
2020-03-27 19:44:04 +02:00
Brian J. Cardiff
24b9156f19
Avoid creating an invalid RegexLiteral
2020-03-27 09:21:13 -03:00
Vitalii Elenhaupt
59bc021e57
Do not report if Object#to_s is called without receiver
2020-03-26 23:51:54 +02:00
Vitalii Elenhaupt
ff1669ebe8
New rule: Lint/RedundantStringCoercion
2020-03-26 16:26:27 +02:00
Vitalii Elenhaupt
a6958ab455
New rule: EmptyLoop
2020-03-26 10:27:00 +02:00
Vitalii Elenhaupt
1d827b4969
Add specs for COMMENT_DIRECTIVE_REGEX
2020-03-25 18:14:15 +02:00
Vitalii Elenhaupt
4f185db0a2
New rule: SharedVarInSpawn
...
closes #132
2020-03-25 17:52:20 +02:00
Vitalii Elenhaupt
0002c36fae
RedundantNext params
2020-03-24 18:27:49 +02:00
Vitalii Elenhaupt
a5dd07e9e4
New rule: RedundantNext
...
closes #131
2020-03-24 18:06:01 +02:00
Vitalii Elenhaupt
946ec67fae
Include binary op node to redundant return
2020-03-22 20:12:24 +02:00
Vitalii Elenhaupt
2303bd82ae
Ability to excluded globally
2020-03-22 15:05:47 +02:00
Vitalii Elenhaupt
bffc46c545
Ability to configure globs
2020-03-22 15:05:47 +02:00
Vitalii Elenhaupt
aff723b682
Incorrectly reporting shadowingOuterLocalVar within macro included
...
closes #129
2020-02-15 20:49:47 +02:00
Vitalii Elenhaupt
74dfa0b934
Lint/UselessAssign: ignore transformed assignemnts by the compiler
...
closes #127
2020-01-11 23:51:28 +02:00
Vitalii Elenhaupt
6b56c87e78
Shadowing via short instance variable syntax
...
closes #122
2019-11-11 15:51:09 +02:00
Vitalii Elenhaupt
fde321f7e6
New rule: RedundantWithObject ( #121 )
2019-11-10 09:47:30 +02:00
Vitalii Elenhaupt
b6cc454039
New rule: RedundantWithIndex ( #120 )
2019-11-10 09:29:17 +02:00
Vitalii Elenhaupt
07e72b7bf9
Lint in parallel ( #118 )
...
* Lint in parallel
* Synced output for dot/flycheck formatters
* Re-raise exceptions raised in fibers
* Add readme instructions
2019-11-09 19:31:41 +02:00
Vitalii Elenhaupt
4ae0195628
Avoid duplicated sections in a generated TODO file (additional fix)
2019-10-27 22:56:53 +02:00
Vitalii Elenhaupt
111596541b
Avoid duplicated sections in a generated TODO file
2019-10-27 22:15:04 +02:00
Vitalii Elenhaupt
904b5beec2
Lint/UnusedArgument: fails to recognized used argument inside macro
...
closes #117
2019-10-27 21:32:55 +02:00
Vitalii Elenhaupt
677c75716f
Typeof scope
2019-10-27 21:22:33 +02:00
Vitalii Elenhaupt
2704a0d8b1
Do not generate todo file there are no issues
2019-10-27 17:49:30 +02:00
Vitalii Elenhaupt
b868d88a85
CyclomaticCompexity: report onle def name
2019-07-12 23:33:08 +03:00
Vitalii Elenhaupt
ffa5dc9b4c
Crystal 0.29 fixes ( #109 )
...
* Fixes vs crystal head
* Use crystal nightly
* Remove trailing ? from local variable
* Do not use ? in the lhs
ref https://github.com/crystal-lang/crystal/issues/6685#issuecomment-419758587
* Upgrade to crystal 0.29.0 (warnings free) (#108 )
* Remove trailing ? from local variable (take 2)
* Fix Time.now deprecation warnings
* Remove Crystal nightly
2019-06-06 19:10:26 +03:00
Vitalii Elenhaupt
037d1dde74
Performance/FirstLastAfterFilter: ignore .first/.last with args
...
closes #104
2019-06-03 18:25:48 +03:00
Vitalii Elenhaupt
de587f500a
Rename Severity::Refactoring -> Severity::Convention
...
it preserves clang format
2019-05-11 21:17:49 +03:00
Vitalii Elenhaupt
94e1d4567a
Properly report performance rules in macros
...
closes #102
2019-05-05 18:05:08 +03:00
Vitalii Elenhaupt
ca5e894e0b
Rename Severity.from_name to Severity.parse
2019-04-26 18:15:36 +03:00
Vitalii Elenhaupt
af395a3c13
Do not report if disabled rules exist
...
closes #101
2019-04-25 08:47:37 +03:00
Vitalii Elenhaupt
117e100855
Add severity to formatters
2019-04-14 16:45:31 +03:00
Vitalii Elenhaupt
575fe07879
Change the level of failure in the runner
2019-04-14 15:57:48 +03:00
Vitalii Elenhaupt
f6a57f9272
Set default severities
2019-04-14 12:15:38 +03:00
Vitalii Elenhaupt
0be42f94db
Convertable severity
2019-04-13 21:16:59 +03:00
Vitalii Elenhaupt
c95ea297bd
Stop calculating cyclomatic complexity for methods which have Macro conditions ( #99 )
2019-03-31 20:27:20 +03:00
Vitalii Elenhaupt
a059ade305
Remove one-line methods
...
Unnecessary level of abstraction
2019-03-23 19:25:16 +02:00
Vitalii Elenhaupt
3a71b86193
Properly report literals ( #96 )
2019-03-23 19:20:32 +02:00
Sijawusz Pur Rahnama
e8a68a80d5
Fix several misspellings ( #94 )
2019-02-23 07:06:28 +02:00
Hannes Käufler
e850bff60f
Hk cyclomatic complexity ( #92 )
...
* Proof of concept for cyclomatic complexity
* Enable configurability of rule
* Use the same nodes to increment the complexity as rubocop
* Fix typo in test description
* Properly indent code and simplify macro
* Move metric into metrics
* Cover a violation supressed by increased threshold
* Extract visitor into its own file
* Document cyclomatic complexity rule and visitor
* Refactor specs to use a macro
* Indent code inside macro
* Replace array with tuple for string formatting.
`Tuple` is stack based, whereas `Array` is allocated on the heap increasing GC pressure.
* Fix formatting
* Enable cyclomatic complexity rule by default
2019-02-16 21:03:44 +02:00
Vitalii Elenhaupt
3c5e3cdef4
Exclude globs as arguments
...
Examples:
$ ameba path/to/shard/*.cr !path/to/shard/lib
$ ameba . !lib
2019-01-13 10:48:46 +02:00
Vitalii Elenhaupt
866af184f1
Redundant return ( #87 )
2018-12-30 09:04:59 +02:00
Vitalii Elenhaupt
c91da1aa08
Let ameba explain the issue at the specified location ( #86 )
2018-12-27 23:34:10 +02:00
Vitalii Elenhaupt
32ac199162
Correct trailing blank line position
2018-12-24 00:44:15 +02:00
Vitalii Elenhaupt
60ce034f1b
UnusedArgument: fix crystal upgrade regression
2018-12-12 22:21:33 +02:00
Vitalii Elenhaupt
f671d6f857
Show affected code while using a default formatter
2018-12-12 21:45:00 +02:00
Vitalii Elenhaupt
20938da89a
Dynamically load rule documentation
2018-12-08 22:52:32 +02:00
Vitalii Elenhaupt
f8dab3bc34
MethodNames: correct reported location/end_location
2018-11-25 00:56:21 +02:00
Vitalii Elenhaupt
e951c0772a
ConstantNames: correct reported end_location
2018-11-25 00:37:46 +02:00
Vitalii Elenhaupt
9885457227
Track issue.end_location properly
2018-11-24 19:38:13 +02:00
V. Elenhaupt
0fd5890738
Extend UnreachableCode rule: handle control flow ( #83 )
2018-11-22 10:38:32 +02:00
Vitalii Elenhaupt
eca0f3f350
Handle raise, exit, abort in unreachable code
2018-11-11 20:33:48 +02:00
Vitalii Elenhaupt
67d76116f7
Basic implementation of UnreachableCode rule
2018-11-05 21:39:27 +02:00
Vitalii Elenhaupt
12aa48c98f
Fix Style/RedundantBegin: begin-end in a proc literal
...
closes #80
2018-09-22 21:58:38 +03:00
Vitalii Elenhaupt
d7b0e10d1e
Normalize sources for tests
2018-09-07 15:07:03 +03:00
V. Elenhaupt
cb5f802012
Correctly process record declaration at a top level ( #78 )
2018-09-07 00:47:02 +03:00
Vitalii Elenhaupt
18ac04d992
Generate UTC time in todo
2018-09-06 18:48:36 +03:00
V. Elenhaupt
fd78d17c40
New rule: Performance/FirstLastAfterFilter ( #76 )
2018-09-06 17:59:11 +03:00
Vitalii Elenhaupt
a1b34eb7be
New rule: Performance/AnyAfterFilter
2018-09-03 22:55:10 +03:00
Vitalii Elenhaupt
790b519653
Performance/Count -> Performance/SizeAfterFilter
2018-09-03 22:44:30 +03:00
Vitalii Elenhaupt
799c0fd5e1
Correct location name of reported issue
2018-09-03 13:26:19 +03:00
Vitalii Elenhaupt
446f557c23
New rule: Performance/Count
2018-09-03 01:07:34 +03:00
Vitalii Elenhaupt
f4680a75f4
Apply default formatting
2018-09-03 00:17:56 +03:00
Vitalii Elenhaupt
d60aea102f
Add --no-color cli flag
...
closes #72
2018-08-13 00:05:11 +03:00
Vitalii Elenhaupt
248c5a656b
Add --all
cli flag that enables all available rules
2018-07-04 15:20:35 +03:00
Vitalii Elenhaupt
dbac46b68a
Ignore outer shadowing of throwaway variables
...
closes #67
2018-06-25 17:02:46 +03:00
Vitalii Elenhaupt
98f0aa71e9
Allow to disable group of rules using inline directives
2018-06-23 16:52:48 +03:00
Vitalii Elenhaupt
04c7300964
Handle type declarations in scopes
...
closes #66
2018-06-23 08:48:13 +03:00
V. Elenhaupt
fafc5f4bdc
Allow filtering by group name ( #65 )
2018-06-18 10:25:06 +03:00
V. Elenhaupt
4cb5328513
Add rule namespaces: style, lint, layout ( #63 )
2018-06-16 14:50:59 +03:00
Vitalii Elenhaupt
23245d0e52
Add end_location to json formatter
2018-06-12 12:55:56 +03:00
Vitalii Elenhaupt
f8d14d4222
Rename Error to Issue
2018-06-12 12:55:56 +03:00
Vitalii Elenhaupt
e1b51f62a5
Exclude file pattern match
...
closes #61
2018-05-29 13:19:00 +03:00
Vitalii Elenhaupt
c12b4f1aa5
Shadowed argument
2018-05-29 09:47:32 +03:00
Vitalii Elenhaupt
15bb8f5331
Detect shadowing outer local vars
2018-05-29 09:47:20 +03:00
Vitalii Elenhaupt
3887da1438
Redundant begin: do not report if there is an inner handler
...
fixes #56
2018-05-25 11:23:11 +03:00
Brian J. Cardiff
3e099e9afc
Support upcoming Crystal 0.25.0
...
The changes are compatible with crystal 0.24.2
2018-05-23 13:29:27 +03:00
Vitalii Elenhaupt
1cea21b147
Do not report float numbers as large if fraction has less than 3 digits
2018-05-13 19:04:15 +03:00
Vitalii Elenhaupt
402a0c0dab
Unused argument name suggession
2018-05-13 14:13:57 +03:00
Vitalii Elenhaupt
bf907ee98b
Rework variable references detection in macro
2018-05-12 20:08:24 +03:00
Vitalii Elenhaupt
efe67212b0
Support of Crystal::UnitializedVar
2018-05-12 18:29:31 +03:00
Vitalii Elenhaupt
415432713a
Prevent false positiveness cause by macro literals
...
https://github.com/crystal-lang/crystal/pull/6055#issuecomment-386376227
2018-05-12 17:37:54 +03:00
Vitalii Elenhaupt
6579c8f573
Ignore config if todo formatter is used
...
Fixes #53
2018-05-11 21:39:09 +03:00
Vitalii Elenhaupt
4546b90b54
Add JSON formatter
2018-05-11 21:28:30 +03:00
Vitalii Elenhaupt
1fc0c525bd
Do not report unneeded disable directive if directive is used one line above
2018-05-09 00:14:46 +03:00
Vitalii Elenhaupt
eab5499f8e
Add a workaround for https://github.com/crystal-lang/crystal/pull/6032
2018-05-08 22:18:15 +03:00
V. Elenhaupt
c2aa526e21
Unused argument rule ( #52 )
...
* Unused argument rule
* IgnoreDefs, IgnoreBlocks, IgnoreProcs parameters
* Implicit reference by super keyworkd
* Handle macro arguments
2018-05-08 22:00:17 +03:00
V. Elenhaupt
6475c2bb25
Variable scope & useless assignments ( #41 )
...
* AST::Visitor -> AST::NodeVisitor
* Scope & ScopeVisitor
* Useless assignment rule
* Instance vars and useless assignments
* Multiple assigns one by one
* Support outer scope
* Variable used in the useless assignment
* Support OpAssign & MultiAssign
* Captured by block
* Variable, Assignment, Reference & Refactoring
* Variable has references, Assignment can be referenced
* Branch entity
* Handle useless assignments in branches
* Handle assignments in a loop
* Handle branch equality
* Handle special var `$?` assignment
* Improve captured by block stuff
* Avoid assignments in property definitions
(UselessAssign rule reports an warning)
* Support MacroIf and MacroFor branches
* Handle assignments with shadowed vars in inner scopes
* Add method arguments as scope variables
* Handle case if branch is blank
* Top level scope
* Handle case when branch is nop?
2018-05-03 18:57:47 +03:00
Vitalii Elenhaupt
d307f01bfa
Add a space delimiter to duplicated hash keys
2018-04-13 20:10:21 +03:00
Hugo Abonizio
d6c6af883d
Ignores PredicateName if alternative isn't valid (e.g. is_404?)
2018-04-12 19:20:41 +03:00
Vitalii Elenhaupt
9e2ab9c002
Show hash duplicated keys in error message
...
closes #45
2018-04-12 19:18:33 +03:00