Commit graph

375 commits

Author SHA1 Message Date
Sijawusz Pur Rahnama
04b19a60db
Merge pull request #300 from crystal-ameba/Sija/some-refactors
Misc refactors
2022-11-14 17:27:29 +01:00
Sijawusz Pur Rahnama
e668ba5bf5 Readability-related refactors 2022-11-14 02:26:52 +01:00
Sijawusz Pur Rahnama
a6ebb48f14 Remove redundant parentheses in if expressions
+ `elsif` -> `case`
2022-11-14 01:52:07 +01:00
Sijawusz Pur Rahnama
d1bfdaabeb Use #in? instead of #includes? in several places
Because:

1. it’s more semantically descriptive
2. it’s shorter
2022-11-14 01:18:43 +01:00
Sijawusz Pur Rahnama
ed6085e6a6 Several refactors in Style/GuardClause rule
Mostly readability related
2022-11-14 01:18:43 +01:00
Sijawusz Pur Rahnama
353c0a1583 Fix typo + add NOTE pragma 2022-11-14 01:05:13 +01:00
Sijawusz Pur Rahnama
5db7a2cf5a Turn on Style/PredicateName rule by default 2022-11-13 20:12:39 +01:00
Sijawusz Pur Rahnama
52bf0a5be4 Refactor Style/PredicateName rule
Do not report `has_<name>?` method names
2022-11-13 20:12:23 +01:00
Sijawusz Pur Rahnama
84540d2a22 Change to alternative approach skipping all macro contexts 2022-11-13 01:25:24 +01:00
Sijawusz Pur Rahnama
5491d31b5f Fix the edge case re: free var comparison 2022-11-13 01:24:59 +01:00
Sijawusz Pur Rahnama
aee5de517b Add Crystal::Path to the list of primitive types
So, the  comparisons like `Regex == 1=42` will also be detected.
2022-11-02 02:06:22 +01:00
Sijawusz Pur Rahnama
6bf8db81e3 Refactor Lint/StaticComparison to LiteralsComparison 2022-11-02 02:00:37 +01:00
Sijawusz Pur Rahnama
ea42911c3c Extend StaticComparison w/ support of === operator 2022-11-01 03:35:20 +01:00
Sijawusz Pur Rahnama
849be52618 Add Lint/StaticComparison rule 2022-11-01 03:34:28 +01:00
Sijawusz Pur Rahnama
63407c1bd1 Rename to Lint/NotNilAfterNoBang 2022-11-01 02:13:04 +01:00
Sijawusz Pur Rahnama
9515e624c3 Add Lint/NotNilWithNoBang rule 2022-10-31 14:17:47 +01:00
Sijawusz Pur Rahnama
8d4a4dfd7a
Merge pull request #290 from crystal-ameba/Sija/remove-trailing-dots-from-rule-descriptions
Remove trailing dots from rule descriptions
2022-10-30 23:51:32 +01:00
Sijawusz Pur Rahnama
038a3657c0
Merge pull request #288 from crystal-ameba/Sija/lint-not-nil-rule
Add `Lint/NotNil` rule
2022-10-30 23:50:38 +01:00
Sijawusz Pur Rahnama
d942524efa Remove trailing dots from rule descriptions 2022-10-30 21:53:09 +01:00
Sijawusz Pur Rahnama
eb64fde437 Fix few issues reported by the newly added rule 2022-10-30 21:44:55 +01:00
Sijawusz Pur Rahnama
67356f246b Add Lint/NotNil rule 2022-10-30 21:36:47 +01:00
Sijawusz Pur Rahnama
6834292265
Merge pull request #287 from crystal-ameba/enable-lint-empty-expression-by-default
Enable `Lint/EmptyExpression` by default
2022-10-30 21:01:28 +01:00
Sijawusz Pur Rahnama
e54e5d0534 Fix Source::Corrector#remove_{leading,trailing} methods 2022-10-30 19:50:25 +01:00
Sijawusz Pur Rahnama
2d3bca7b1a
Enable Lint/EmptyExpression by default 2022-10-30 15:30:55 +01:00
Sijawusz Pur Rahnama
400954ebb5 Use String#hash instead of Digest::SHA1.hexdigest 2022-10-29 21:49:00 +02:00
Sijawusz Pur Rahnama
4700ae7649
Merge pull request #282 from crystal-ameba/Sija/fix-issue-270
Populate `Rule::Base+.parsed_doc` on compile time
2022-10-29 18:12:55 +02:00
Sijawusz Pur Rahnama
ca2c5a7273 Small refactor to DocFinder#visit 2022-10-29 18:07:52 +02:00
Sijawusz Pur Rahnama
d55b93c866 Rename read_rule_doc -> read_type_doc
Also, move the helper script into the `contrib` directory
2022-10-29 18:03:30 +02:00
Sijawusz Pur Rahnama
a9ae491aca
Merge pull request #280 from crystal-ameba/Sija-verbose-block-configuration-example-typo 2022-10-29 11:59:06 +02:00
Sijawusz Pur Rahnama
3d61254739 Populate Rule::Base+.parsed_doc on compile time 2022-10-29 01:35:34 +02:00
Sijawusz Pur Rahnama
ffc712a838 Reduce usage of Object#not_nil! 2022-10-29 00:03:39 +02:00
Sijawusz Pur Rahnama
4063290530
Fix typo in a Style/VerboseBlock configuration example 2022-10-28 23:48:47 +02:00
Vitalii Elenhaupt
60bf8e13ce
fix(style): properly tokenize in RedundantBegin rule 2022-10-14 21:09:30 +03:00
Vitalii Elenhaupt
d2fbf484f4
Crystal 1.6 support 2022-10-14 20:55:29 +03:00
Anton Maminov
1bef5fc5c1
fix restriction issue (#271)
Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>
2022-08-01 23:50:30 +02:00
Sijawusz Pur Rahnama
fbd72a5171 Fix regression in AnyInsteadOfEmpty rule 2022-04-22 00:58:37 +02:00
Sijawusz Pur Rahnama
e2faffacfe
Merge branch 'master' into fix/crystal-nightly 2022-04-05 00:37:48 +02:00
Sijawusz Pur Rahnama
e6ad7c5d24 Fix bug in AST::Scope#in_macro? not taking account for Crystal::MacroFor 2022-04-04 02:05:13 +02:00
Sijawusz Pur Rahnama
71de3f0012 Cleanup method docs in AST::Scope 2022-04-04 02:05:13 +02:00
Sijawusz Pur Rahnama
614fcfa6a8 Skip macro scopes in ShadowingOuterLocalVar 2022-04-04 01:38:04 +02:00
Sijawusz Pur Rahnama
2e9ef7fcb2 Reword visit(node) methods comment in AST::NodeVisitor 2022-04-04 01:35:59 +02:00
Sijawusz Pur Rahnama
a38cfd1661 Refactor AST::ScopeVisitor similarly to AST::NodeVisitor 2022-04-04 01:35:32 +02:00
Sijawusz Pur Rahnama
3f7ade573a Add ability to skip some of the nodes in AST::ScopeVisitor 2022-04-04 01:34:34 +02:00
Sijawusz Pur Rahnama
353d09df29 Rename file according to the rule name 2022-04-04 00:42:22 +02:00
Vitalii Elenhaupt
8d4730182f
Rework breaking specs, break backward compatibility 2022-04-04 00:59:21 +03:00
Vitalii Elenhaupt
2f29999106
Return boolean 2022-04-03 19:43:51 +03:00
Vitalii Elenhaupt
087f470f15
Backward compatibility to Crystal 1.3 2022-04-03 19:17:47 +03:00
Vitalii Elenhaupt
7192b64df0
Fix rest of the specs 2022-03-11 18:00:25 +02:00
Vitalii Elenhaupt
1cfc926a28
Fix specs for tokenizer 2022-03-11 16:18:33 +02:00
Vitalii Elenhaupt
03adc20872
Pass on crystal-nightly 2022-03-11 14:15:05 +02:00