Commit graph

569 commits

Author SHA1 Message Date
Sijawusz Pur Rahnama
b25dc402c8 Group naming-related rules 2023-11-09 00:16:29 +01:00
Sijawusz Pur Rahnama
8569355b5a Move documentation-related rules into its own group 2023-11-08 18:35:32 +01:00
Sijawusz Pur Rahnama
0140fd3573 Add Lint/Typos rule 2023-11-08 02:24:35 +01:00
Sijawusz Pur Rahnama
d5ac394d19 Switch only FIXME comment to TODO 2023-11-06 16:59:09 +01:00
Sijawusz Pur Rahnama
bdbb79f1fa Fix nonexistent method name used in error message 2023-11-06 16:59:09 +01:00
Sijawusz Pur Rahnama
1b342e8257 Make TODOFormatter's configuration file path configurable
Fixes the case where formatter specs were deleting project's `.ameba.yml` file
2023-11-06 16:59:09 +01:00
Sijawusz Pur Rahnama
23c61e04c0 Add Lint/DocumentationAdmonition rule 2023-11-06 16:59:09 +01:00
Sijawusz Pur Rahnama
1b57e2cad5 Make Formatter::Util extend itself for easier access 2023-11-05 06:08:40 +01:00
Sijawusz Pur Rahnama
3d3626accc Introduced new presenter abstraction 2023-11-04 01:44:59 +01:00
Sijawusz Pur Rahnama
bede3f97a1 Colorize code in rule descriptions too 2023-11-04 00:49:11 +01:00
Sijawusz Pur Rahnama
8ff621ba66 Add --describe CLI switch 2023-11-04 00:49:11 +01:00
Sijawusz Pur Rahnama
f1f21ac94d Refactor --rules CLI switch output 2023-11-04 00:49:11 +01:00
Sijawusz Pur Rahnama
1718945523 Refactor ExplainFormatter a bit 2023-11-04 00:49:11 +01:00
Vitalii Elenhaupt
789e1b77e8
fix: crystal next compatibility
refs https://github.com/crystal-lang/crystal/pull/11597
fixes https://github.com/crystal-ameba/ameba/issues/406
2023-10-06 18:57:39 +03:00
Stuart Frost
1b85ba6f22 Refactor: use unless instead of if not 2023-08-05 19:28:47 +01:00
Stuart Frost
eb60b25c4e Refactor building default globs 2023-08-05 16:15:50 +01:00
Stuart Frost
7690074cab Conditionally add !lib to default globs 2023-08-04 21:48:35 +01:00
Stuart Frost
07aebfc84a
Merge branch 'master' into 388-raise-on-invalid-file-path 2023-07-26 15:22:04 +01:00
Stuart Frost
3b9c442e09 Raise error when passed invalid file paths 2023-07-26 15:01:59 +01:00
Stuart Frost
4741c9f4c4 Reword generic error message on config load 2023-07-25 08:46:13 +01:00
Stuart Frost
d9b2d69055 Reword error when file doesn't exist
Applied suggestion from PR

Co-authored-by: Vitalii Elenhaupt <3624712+veelenga@users.noreply.github.com>
2023-07-25 08:43:49 +01:00
Stuart Frost
5f878fb40f Move missing config file check into Ameba::Config 2023-07-24 19:10:52 +01:00
Stuart Frost
01a943d0d6 Raise error when passed invalid config file path 2023-07-24 15:30:38 +01:00
Sijawusz Pur Rahnama
ddff8d226b Add Performance/MinMaxAfterMap rule 2023-07-10 15:46:17 +02:00
Sijawusz Pur Rahnama
5cff76071a No need for such micro-optimizations, LLVM takes care of those 2023-07-02 14:34:25 +02:00
Sijawusz Pur Rahnama
29e29b8e1d Fix Performance/ExcessiveAllocations to exclude each calls without a block 2023-06-30 21:44:47 +02:00
Sijawusz Pur Rahnama
abe5237802 Add Performance/ExcessiveAllocations rule 2023-06-30 15:17:40 +02:00
Sijawusz Pur Rahnama
4d0125a0f3 Fix Style/VerboseBlock rule to work with binary operations 2023-06-29 08:15:39 +02:00
Sijawusz Pur Rahnama
16141a376e Cleanup properties definition macro 2023-06-14 15:08:19 +02:00
Sijawusz Pur Rahnama
596b0dd9d0 Misc tweaks and refactors 2023-06-14 15:06:24 +02:00
Sijawusz Pur Rahnama
1931a5f4ef Make skip a named argument 2023-06-12 23:17:14 +02:00
Sijawusz Pur Rahnama
c09b36799a Make AST::NodeVisitor::Category a flag enum 2023-06-12 23:17:14 +02:00
Sijawusz Pur Rahnama
38b6751bc0 Add AST::NodeVisitor::Category simplifying code a bit 2023-06-12 23:17:14 +02:00
Sijawusz Pur Rahnama
b156a6a6a1 Add comments to macros 2023-06-08 14:03:35 +02:00
Sijawusz Pur Rahnama
94e31d4685 Do the same in NodeVisitor 2023-06-08 04:28:37 +02:00
Sijawusz Pur Rahnama
e12d72cc88 Set the ASTNode#visibility as well 2023-06-08 04:28:17 +02:00
Sijawusz Pur Rahnama
7caa47fb6a Several small refactors 2023-06-08 02:04:30 +02:00
Sijawusz Pur Rahnama
4d8346509e Implement Documentation rule on top of the ScopeVisitor 2023-06-08 02:04:06 +02:00
Sijawusz Pur Rahnama
4c740f394a Implement Scope#visibility 2023-06-08 01:58:58 +02:00
Sijawusz Pur Rahnama
85c3db4d74 Move NODES constant into its proper namespace 2023-05-31 13:15:01 +02:00
Sijawusz Pur Rahnama
6e5a9a60b3 Refactor Lint::Documentation and ignore macro hooks 2023-05-29 17:09:39 +02:00
Sijawusz Pur Rahnama
09fdac6be9 Refactor Lint::Documentation rule to use a custom visitor 2023-05-29 16:33:45 +02:00
Sijawusz Pur Rahnama
1a9a58b3cd Add Lint/Documentation rule 2023-05-29 16:32:51 +02:00
Sijawusz Pur Rahnama
d0d8b18c83
Raise when empty severity provided to SeverityYamlConverter.from_yaml 2023-05-09 13:02:10 +02:00
Sijawusz Pur Rahnama
14f6ba0c0b
Merge pull request #323 from crystal-ameba/Sija/lint-not-nil-after-no-bang-reports-rindex-calls
Make `Lint/NotNilAfterNoBang` report calls to `#rindex`
2023-05-01 11:16:42 +02:00
Billy.Zheng
239f64c278 Refactor 2023-03-09 12:41:40 +08:00
Billy.Zheng
d45285d1c9 Skip all config when use with --gen-config. 2023-03-08 22:34:46 +08:00
Sijawusz Pur Rahnama
4c59858f25 Apply code review suggestions 2023-03-06 21:22:47 +01:00
Sijawusz Pur Rahnama
8d56f22af1 Document the new Config.load behaviour 2023-03-06 21:19:47 +01:00
Sijawusz Pur Rahnama
e481a8d139 Use FILENAME constant consistently 2023-03-06 20:54:35 +01:00
Sijawusz Pur Rahnama
102e2834b6 Honor XDG_CONFIG_HOME ENV variable
Following XDG Spec: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
2023-03-06 20:54:35 +01:00
Sijawusz Pur Rahnama
749da0984c Rename Config::PATH to Config::DEFAULT_PATH 2023-03-06 20:54:35 +01:00
Sijawusz Pur Rahnama
9534104942 Support hierarchical loading of the config file 2023-03-06 20:54:17 +01:00
Vitalii Elenhaupt
81177dc7e4
Merge pull request #356 from crystal-ameba/chore/crystal-nightly
chore: fix crystal-nightly compatibility
2023-02-19 18:06:31 +02:00
Vitalii Elenhaupt
d03f058cae
Add semicolon to the error message 2023-02-19 17:39:25 +02:00
Vitalii Elenhaupt
be8862837f
Improve error message reported to end user 2023-02-19 14:45:07 +02:00
Vitalii Elenhaupt
63a54986dd Reformat code example 2023-02-19 13:24:54 +01:00
Vitalii Elenhaupt
c9c5fb655f
fix(style): correct typo in rule doc 2023-02-19 13:47:17 +02:00
Vitalii Elenhaupt
17e9566c7e
fix(lint): Lint/UnusedBlockArgument is triggered by abstract def
closes #352
2023-02-19 10:51:52 +02:00
Vitalii Elenhaupt
031c1daf58
chore: fix crystal-nightly compatibility 2023-02-19 09:30:05 +02:00
Vitalii Elenhaupt
d20cc212b9
Styling changes 2023-02-07 20:03:52 +02:00
Vitalii Elenhaupt
6b2ddcb1d9
Address feedback, add tests 2023-02-07 17:19:04 +02:00
Vitalii Elenhaupt
14a9ec3a75
Incorporate changes for shadowing outer local var 2023-02-04 20:53:41 +02:00
Vitalii Elenhaupt
ddbcf5cb3f
fix(lint): useless assignment for type definition
closes #342
2023-02-04 16:57:46 +02:00
Sijawusz Pur Rahnama
ce4dd7236a Make Lint/NotNilAfterNoBang report calls to #rindex 2023-01-10 13:37:28 +01:00
Sijawusz Pur Rahnama
3b79392ef2 Simplify implementation of Lint/EmptyExpression rule 2023-01-10 13:10:05 +01:00
Sijawusz Pur Rahnama
6f0b6ffcd0 Remove buggy auto-correction from Performance/AnyInsteadOfEmpty rule 2023-01-04 02:40:07 +01:00
Sijawusz Pur Rahnama
caaf803ecd Tweak reported location for Style/UnlessElse 2022-12-23 14:46:45 +01:00
Sijawusz Pur Rahnama
bbbfdfc5a2 Tweak reported location for Lint/UnusedBlockArgument 2022-12-23 14:46:23 +01:00
Sijawusz Pur Rahnama
2d9e328d97
Merge pull request #325 from FnControlOption/unless_else
Add autocorrect for `Style/UnlessElse`
2022-12-22 21:43:49 +01:00
Sijawusz Pur Rahnama
2cedd72b09 Apply review sugggestions 2022-12-22 19:18:27 +01:00
Sijawusz Pur Rahnama
4f8b79ec6b
Merge pull request #324 from crystal-ameba/Sija/extend-several-rule-with-corrections
Extend `Lint/UnusedArgument` and `Lint/UnusedBlockArgument` rules with corrections
2022-12-22 18:42:35 +01:00
Sijawusz Pur Rahnama
3586b4242f Extend Lint/UnusedBlockArgument rule with corrections 2022-12-22 17:15:46 +01:00
Sijawusz Pur Rahnama
f26cd7f823 Extend Lint/UnusedArgument rule with corrections 2022-12-22 17:15:46 +01:00
Sijawusz Pur Rahnama
b9bc5aaab2
Merge pull request #327 from crystal-ameba/Sija/specs-cleanup 2022-12-22 12:08:44 +01:00
Sijawusz Pur Rahnama
206b5ab604 Refactor: Source#correct -> Source#correct? 2022-12-20 17:04:34 +01:00
Sijawusz Pur Rahnama
cabf203e0d
Merge pull request #326 from crystal-ameba/Sija/lint-formatting 2022-12-20 16:20:48 +01:00
Sijawusz Pur Rahnama
47b92fbb76 Fix newly found issues 2022-12-20 15:31:14 +01:00
Sijawusz Pur Rahnama
597372c645 Add Lint/MissingBlockArgument rule 2022-12-20 15:31:14 +01:00
Sijawusz Pur Rahnama
3bc8bda008 Add Lint/Formatting rule 2022-12-20 04:10:56 +01:00
Sijawusz Pur Rahnama
4e3caf2986 Few tweaks and readability refactors 2022-12-20 03:26:13 +01:00
Sijawusz Pur Rahnama
ab059616b5 Switch from Hash to NamedTuple for AmbiguousAssignment::MISTAKES 2022-12-20 03:25:14 +01:00
Sijawusz Pur Rahnama
8112dddc8f Specs cleanup 2022-12-20 03:25:06 +01:00
fn ⌃ ⌥
d7795c0d7d Add autocorrect for Style/UnlessElse 2022-12-19 06:40:28 -08:00
Sijawusz Pur Rahnama
bb0c0eeec6 Consider previous_def implicitly accessing variables, in the same way as super does 2022-12-15 18:35:16 +01:00
Sijawusz Pur Rahnama
b6f3d41211 Small refactor 2022-12-15 18:35:16 +01:00
Sijawusz Pur Rahnama
7f6bd2289e Do not report unused block arguments in Lint/UnusedArgument rule 2022-12-15 18:35:16 +01:00
Sijawusz Pur Rahnama
858557bc07 Add Lint/UnusedBlockArgument rule 2022-12-15 18:35:16 +01:00
Sijawusz Pur Rahnama
6ffb635dcc Add Scope#yields? 2022-12-15 18:35:16 +01:00
Sijawusz Pur Rahnama
9df66e890b Do not report anonymous block arguments in Lint/UnusedArgument 2022-12-12 18:21:19 +01:00
Sijawusz Pur Rahnama
4d9cd4d56c Fix typo 2022-12-10 00:24:04 +01:00
Sijawusz Pur Rahnama
a8fca61b22 Doc tweaks 2022-12-10 00:20:20 +01:00
Sijawusz Pur Rahnama
2dc21a00d9 Remove treating paths as literals in AST::Util#literal? & friends 2022-12-08 17:47:22 +01:00
Sijawusz Pur Rahnama
0bd4ed0c45 Do not treat paths as literals in Lint/LiteralAssignmentsInExpressions 2022-12-08 17:47:22 +01:00
Sijawusz Pur Rahnama
db3ef762b9 Uncomment forgotten line 2022-12-08 17:47:22 +01:00
Sijawusz Pur Rahnama
07ce595ef2 Readability refactors 2022-12-08 17:47:22 +01:00
Sijawusz Pur Rahnama
784e3ac616 Use bang variants in couple of places more 2022-12-08 13:59:42 +01:00
Sijawusz Pur Rahnama
5ab4b05add Fix incorrect Reportable#add_issue(&) definition 2022-12-08 13:59:03 +01:00
Sijawusz Pur Rahnama
7d88455b7f Add corrector to the Style/IsANil rule 2022-12-08 13:58:35 +01:00
Sijawusz Pur Rahnama
2cb8c1381f Don’t treat crystal paths as literals in Lint/LiteralsComparison 2022-12-08 13:55:29 +01:00