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
Sijawusz Pur Rahnama
cdf0405496
Refactor Style/IsANil
rule to use newly added path_named?
helper
2022-12-08 02:16:16 +01:00
Sijawusz Pur Rahnama
f45d6a2ef0
Fix newly found issue
2022-12-08 02:16:16 +01:00
Sijawusz Pur Rahnama
1524aad299
Add Style/QueryBoolMethods
rule
2022-12-08 02:16:16 +01:00
Sijawusz Pur Rahnama
4dd62a3ed1
Colorize also the code in single backticks
2022-11-28 11:49:26 +01:00
Sijawusz Pur Rahnama
2113e8c055
Refactor MacroReferenceFinder
class a bit
2022-11-28 11:38:41 +01:00
Sijawusz Pur Rahnama
a8f953a2b2
Compress identical method definitions
2022-11-28 11:38:41 +01:00
Sijawusz Pur Rahnama
b79f3e6e07
Minor refactors in Style/LargeNumbers
rule
2022-11-28 11:38:41 +01:00
Sijawusz Pur Rahnama
134963ece7
Minor details
2022-11-28 11:38:41 +01:00
Sijawusz Pur Rahnama
523a622b34
Remove leftover from some merge/rebase gone wrong
2022-11-28 11:38:41 +01:00
Sijawusz Pur Rahnama
5502f0f8d1
Small refactor using Object#in?
2022-11-28 11:38:41 +01:00
Sijawusz Pur Rahnama
748cab29b4
Remove redundant empty comment lines
2022-11-28 11:38:41 +01:00
Sijawusz Pur Rahnama
629e65127d
if … == nil
-> unless …
2022-11-28 11:38:41 +01:00
Sijawusz Pur Rahnama
adff510cb6
Autocasting will do the work
2022-11-28 11:38:41 +01:00
Sijawusz Pur Rahnama
33ef9c6293
Refactor ExplainFormatter
2022-11-28 11:38:41 +01:00
Sijawusz Pur Rahnama
f9b05a309e
Redundant whitespace before nl
2022-11-28 11:25:21 +01:00
Sijawusz Pur Rahnama
0f893971dc
Avoid one-letter names if possible
2022-11-28 11:25:21 +01:00
Sijawusz Pur Rahnama
d19d3b78c4
Implement Severity#color
property
2022-11-28 06:07:19 +01:00
Sijawusz Pur Rahnama
6a180757f3
Use Enumerable#zip
ftw
2022-11-23 16:16:34 +01:00
Sijawusz Pur Rahnama
1399aa3cdf
Doc fixes
2022-11-23 16:16:03 +01:00
Sijawusz Pur Rahnama
75482a06cf
Use warning as a default severity for Metrics
and Performance
groups
2022-11-23 15:06:24 +01:00
Sijawusz Pur Rahnama
3b7cd3723c
Refactor rules’ default group severity handling
2022-11-23 15:04:47 +01:00
Sijawusz Pur Rahnama
735ec2462a
Refactor usages of \
to sth more readable if possible
2022-11-23 05:50:32 +01:00
Sijawusz Pur Rahnama
2c67fe2c3f
Use tuple instead of an array
2022-11-23 03:23:42 +01:00
Sijawusz Pur Rahnama
8b43a40a65
Misc refactors
2022-11-23 03:22:27 +01:00
Sijawusz Pur Rahnama
ffd63ef028
Fix typo in AST::Branchable
example
2022-11-23 03:21:49 +01:00
Sijawusz Pur Rahnama
4500181ddb
Remove redundant blank comment lines
2022-11-23 03:21:15 +01:00
Sijawusz Pur Rahnama
2af58cabd4
Use property?
for defining Bool
-returning Rule
properties
2022-11-22 19:49:16 +01:00
Sijawusz Pur Rahnama
c7c75ee36a
Rule#enabled
-> Rule#enabled?
2022-11-22 19:47:37 +01:00
Sijawusz Pur Rahnama
31392046e0
Always return Bool
value from Rule#excluded?
2022-11-22 19:45:16 +01:00
Sijawusz Pur Rahnama
39cc286263
Use tuple instead of array for Rule::SPECIAL
2022-11-22 19:44:38 +01:00
Sijawusz Pur Rahnama
5ee4074c1b
Rename RedundantParentheses
-> ParenthesesAroundCondition
...
Also rename the option: `parenthesized_assignments` -> `allow_safe_assignment`
2022-11-18 21:06:51 +01:00
Sijawusz Pur Rahnama
eabe463386
Instead of adding the new rule to support enforcing parens around assignments, refactor existing RedundantParentheses
rule
2022-11-18 05:27:05 +01:00
Sijawusz Pur Rahnama
94a271b2a1
Add Style/ParenthesizedAssignments
rule
2022-11-17 21:32:47 +01:00
Sijawusz Pur Rahnama
496e8930e2
Merge pull request #303 from crystal-ameba/Sija/lint-literal-assignments-in-expressions-rule
...
Add `Lint/LiteralAssignmentsInExpressions` rule
2022-11-17 14:19:17 +01:00
Sijawusz Pur Rahnama
95d68114c7
Fix typos throughout the code
2022-11-16 16:55:32 +01:00
Sijawusz Pur Rahnama
f9b6b17657
Merge pull request #305 from crystal-ameba/Sija/followup-to-pr-300
...
Few more readability refactors
2022-11-16 16:26:59 +01:00
Sijawusz Pur Rahnama
5c08b64e72
Add Lint/LiteralAssignmentsInExpressions
rule
2022-11-16 15:08:41 +01:00
Sijawusz Pur Rahnama
28e2871165
Merge pull request #301 from crystal-ameba/Sija/style-redundant-parentheses-rule
...
Add `Style/RedundantParentheses` rule
2022-11-16 12:22:39 +01:00
Sijawusz Pur Rahnama
935296b041
Refactor ternary handling in Style/RedundantParentheses
rule
2022-11-16 03:54:31 +01:00
Sijawusz Pur Rahnama
e54029d8ed
Few more readability refactors
2022-11-15 20:55:32 +01:00
Sijawusz Pur Rahnama
76a4209706
Tweak comments in AST::Util
2022-11-15 17:42:08 +01:00
Sijawusz Pur Rahnama
2fb37da80f
Refactor AST::Util#literal?
helper
2022-11-15 17:42:08 +01:00
Sijawusz Pur Rahnama
3340613a6a
Fix newly found issue
2022-11-15 15:17:32 +01:00
Sijawusz Pur Rahnama
cbf5d3de74
Add Style/RedundantParentheses
rule
2022-11-15 15:17:32 +01:00
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
Sijawusz Pur Rahnama
dad72341cb
Merge pull request #258 from crystal-ameba/bump-large-numbers-min-int-digits
...
Bump default value of `LargeNumbers#int_min_digits` to 6
2022-03-08 14:48:45 +01:00
Sijawusz Pur Rahnama
1795bd2959
Bump default value of LargeNumbers#int_min_digits
to 6
...
As most of the error codes are smaller than 6 digits
2022-03-08 14:42:32 +01:00
Sijawusz Pur Rahnama
9e81777e7e
Disable Style/LargeNumbers
by default
2022-03-05 22:38:36 +01:00
Sijawusz Pur Rahnama
66ee7642cf
Add Lint/DebugCalls
rule
2021-12-31 16:44:02 +01:00
fn ⌃ ⌥
f288cc3c4f
Add Style/GuardClause
rule ( #254 )
2021-12-09 21:33:47 +01:00
fn ⌃ ⌥
63a6c73dc0
Autocorrect various rules ( #253 )
2021-11-16 22:30:33 +01:00
Vitalii Elenhaupt
429f76f8b6
Do not report unreachable code after loops
...
closes #251
2021-11-10 09:16:14 +02:00
fn ⌃ ⌥
01dfcbe76a
Add tests for AST::Util#control_exp_code
2021-11-09 11:52:31 -08:00
fn ⌃ ⌥
c9ba487373
Add custom NodeVisitor
subclass for Style/VariableNames
2021-11-09 09:26:00 -08:00
fn ⌃ ⌥
72a3487bb6
Autocorrect Stye/WhileTrue
2021-11-08 14:24:11 -08:00
fn ⌃ ⌥
571969265f
Convert Style/VerboseBlock
spec
2021-11-08 14:24:11 -08:00
fn ⌃ ⌥
e93dfe9cdc
Convert Style/VariableNames
spec
2021-11-08 14:24:11 -08:00
fn ⌃ ⌥
e7cfe387d6
Autocorrect Stye/RedundantNext
and Style/RedundantReturn
2021-11-08 14:07:35 -08:00
fn ⌃ ⌥
7b437fbd2f
Remove normalize
parameter from expect_issue
( #249 )
...
* Add `normalize` parameter to `expect_correction`
* Convert Style/IsAFilter spec
* Revert "Add `normalize` parameter to `expect_correction`"
This reverts commit 4b67e4b900
.
* Remove `normalize` parameter from `expect_issue`
* Require indentation if multiple issues on a single line
* Update `Style/IsAFilter` spec
* Update `ExpectIssue` documentation
* Add missing `expect_no_corrections`
* Use carets and space with issues at column 1 or 2
* Update `expect_issue` docs
2021-11-06 15:15:19 +02:00
Sijawusz Pur Rahnama
7cb0c15747
Merge pull request #248 from FnControlOption/autocorrect
...
Add autocorrect
2021-11-01 20:24:43 +01:00
fn ⌃ ⌥
c2aa2fedb6
Return source
from expect_issue
2021-10-31 22:44:48 -07:00
fn ⌃ ⌥
470e41cb7b
Raise error if attempting to both explain issue and autocorrect
2021-10-31 22:23:14 -07:00
fn ⌃ ⌥
a40fdee33f
Revert "Add autocorrect checks to ExplainFormatter
"
...
This reverts commit 1b6fe40a3b
.
2021-10-31 22:12:21 -07:00
Vitalii Elenhaupt
3e1df339ae
Consistent parser options
2021-11-01 02:08:16 +02:00
fn ⌃ ⌥
61fc99e107
Inline the do_combine
method
2021-10-27 11:19:15 -07:00
fn ⌃ ⌥
73e97ac42e
Avoid using iterators and throw-away heap allocations
2021-10-27 11:08:18 -07:00
fn ⌃ ⌥
b7bb282b99
Apply suggestions from code review
2021-10-27 10:08:36 -07:00
fn ⌃ ⌥
d51ef27d54
Add remove_preceding
, remove_leading
, remove_trailing
2021-10-26 22:22:22 -07:00
fn ⌃ ⌥
1b6fe40a3b
Add autocorrect checks to ExplainFormatter
2021-10-26 22:22:22 -07:00
fn ⌃ ⌥
8d3b76003e
Add autocorrect checks to Flycheck, JSON, and TODO formatters
2021-10-26 22:22:22 -07:00
fn ⌃ ⌥
749c53527e
Add documentation
2021-10-26 22:22:22 -07:00
fn ⌃ ⌥
437584f9db
Raise error if infinite correction loop
2021-10-26 22:22:22 -07:00
fn ⌃ ⌥
16608965f5
Allowed named arguments with Rule::Base.issue_for
2021-10-26 22:22:22 -07:00
fn ⌃ ⌥
3b11491cea
Add insert_*
overloads that accept both location and end_location
2021-10-26 22:22:22 -07:00
fn ⌃ ⌥
e8c0f49cb8
Delete redundant alias SourceLocation
2021-10-26 22:22:22 -07:00
fn ⌃ ⌥
f87d99a83b
Add Corrector
method overloads that accept ASTNode
2021-10-26 22:22:22 -07:00
fn ⌃ ⌥
1d5f554e88
Apply suggestions from code review
2021-10-26 12:06:24 -07:00
fn ⌃ ⌥
f39a7a4cd4
Re-run autocorrect until all correctable issues have been corrected
2021-10-25 15:09:44 -07:00
fn ⌃ ⌥
573881cb8a
Autocorrect Layout/TrailingBlankLines
partially
2021-10-25 12:38:29 -07:00
fn ⌃ ⌥
e5fb0526e0
Autocorrect Style/LargeNumbers
2021-10-25 12:38:29 -07:00
fn ⌃ ⌥
99e7ccd23b
Add --autocorrect
CLI option
2021-10-25 12:38:29 -07:00
fn ⌃ ⌥
d3d3ccd7e3
Add expect_correction
and expect_no_corrections
2021-10-25 12:38:29 -07:00
fn ⌃ ⌥
c1b4add094
Add Source::Corrector
and Source::Rewriter
2021-10-25 12:38:29 -07:00
fn ⌃ ⌥
9f0b9a709e
Allow named replacements in expect_issue
2021-10-23 01:37:24 -07:00
fn ⌃ ⌥
3d432fdee8
Add expect_issue and expect_no_issues spec helpers ( #245 )
2021-10-22 19:54:39 +02:00
fn ⌃ ⌥
48b15b9bf8
Add Lint/AmbiguousAssignment rule ( #244 )
2021-10-19 11:44:41 +02:00
Sijawusz Pur Rahnama
43dea0e49d
Fix typos throughout the codebase
2021-07-03 14:15:23 +02:00
Caspian Baska
c49c69ed9f
Early return in CountVisitor if macro node
...
Co-authored-by: Sijawusz Pur Rahnama <sija@sija.pl>
2021-06-06 04:12:56 +10:00
Caspian Baska
0ea6238dc6
Count an exhaustive case
's complexity as 1
2021-06-05 22:31:58 +10:00
Vitalii Elenhaupt
a64f48b543
ShadowingOuterLocalVar while it is not in macro
...
closes #224
2021-04-18 20:55:10 +03:00
Vitalii Elenhaupt
9e2d4f1856
Disable performance rules for spec files
...
closes #220
2021-04-18 09:39:55 +03:00
Sijawusz Pur Rahnama
788e0a3fad
Enable MapInsteadOfBlock rule again
2021-04-12 06:23:03 +02:00
Sijawusz Pur Rahnama
2694a0c865
Remove “join” from the list of trigger methods
2021-04-12 06:22:54 +02:00
Vitalii Elenhaupt
58d7775d65
Merge branch 'master' into develop
2021-04-04 21:08:02 +03:00
Sijawusz Pur Rahnama
8d21733b10
Skip macro code in Style/IsAFilter rule
2021-04-04 11:19:45 +02:00
Vitalii Elenhaupt
0881b861d7
Disable MapInsteadOfBlock by default
...
refs #208
2021-03-29 09:15:18 +03:00
Stephen Dolan
04ba9cd57a
Change Style/VerboseBlock - ExcludeOperators - setting default ( #218 )
2021-03-24 21:16:51 +01:00
Vitalii Elenhaupt
13605afe4a
Do not report IsAFilter if there is a block with multiple args
2021-03-23 20:57:50 +02:00
Vitalii Elenhaupt
ad405e09b0
Merge branch 'master' into develop
2021-03-08 11:09:32 +02:00
Sijawusz Pur Rahnama
56110b3883
Default to exclude_multiple_line_blocks in Style/VerboseBlock rule
2021-03-03 00:31:53 +01:00
Sijawusz Pur Rahnama
8f308e73e5
Add ~ as the prefix operator
2021-03-02 12:40:46 +01:00
Vitalii Elenhaupt
3a1ee7fa21
Correct yml examples
2021-02-11 11:01:30 +02:00
Sijawusz Pur Rahnama
694c41650c
Remove redundant check and add a few more test cases
2021-02-05 01:23:29 +01:00
Sijawusz Pur Rahnama
a9d1b17deb
Support named arguments in VerboseBlock#node_to_s
2021-02-05 01:23:29 +01:00
Sijawusz Pur Rahnama
16743a756c
Add ExcludePrefixOperators option to Style/VerboseBlock rule
2021-02-04 21:59:23 +01:00
Sijawusz Pur Rahnama
eed094b928
Fix couple of edge-cases in VerboseBlock rule
2021-02-04 21:59:23 +01:00
Sijawusz Pur Rahnama
5faf8da81c
Split VerboseBlock#test method into a smaller pieces
2021-02-04 21:59:23 +01:00
Sijawusz Pur Rahnama
4b7f3ba6ee
Add MaxLineLength option to Style/VerboseBlock rule
2021-02-04 21:59:22 +01:00
Sijawusz Pur Rahnama
a53d44617d
Fix newly found issues
2021-02-04 21:59:22 +01:00
Sijawusz Pur Rahnama
0739fad670
Add Style/VerboseBlock rule
2021-02-04 21:59:22 +01:00
Sijawusz Pur Rahnama
99da6b6916
Merge remote-tracking branch 'origin/master' into master-into-develop
2021-02-03 22:45:35 +01:00
Vitalii Elenhaupt
f8c22a6e77
Utilize Source#spec?
2021-02-03 17:25:46 +02:00
Vitalii Elenhaupt
ecad80a96b
NewRule: SpecFocus
...
closes #172
2021-02-03 17:10:07 +02:00
Vitalii Elenhaupt
51b0a07e81
Avoid exponential recursion while finding variable references in scopes ( #203 )
...
* Avoid exponential recursion while finding variable references in scopes
* Adjust source example in test
2021-01-31 16:40:44 +02:00
Sijawusz Pur Rahnama
fac8072ec1
Merge pull request #197 from crystal-ameba/feature/any-instead-of-empty
...
Add Performance/AnyInsteadOfEmpty rule
2021-01-28 10:28:30 +01:00
Sijawusz Pur Rahnama
7b3c814914
Fix newly found issues
2021-01-28 01:03:48 +01:00
Sijawusz Pur Rahnama
d71091a40c
Add Performance/AnyInsteadOfEmpty rule
2021-01-28 01:03:48 +01:00
Sijawusz Pur Rahnama
95d340c3ad
Add Style/IsAFilter rule
2021-01-28 00:58:06 +01:00
Sijawusz Pur Rahnama
ea98554191
Add support for showing end location marker ( #200 )
...
* Add support for showing end location marker
* Cleanup Reportable method definitions
There’s no need for double splats, since they mess up method resolution, and obscure the actual - single (!) - argument - `status`, so… be gone
Also, all of the helpers return the constructed `Issue` like a behaving good methods.
* Refactor Util#affected_code
* Increase max length of trimmed lines to 120 characters
* Refactor Issue to use enum instead of a symbol for #status
* Optimize Reportable#valid?
* Add spec coverage for newly added Util methods
* Refactor DotFormatter a bit
Make text format moar in line with Crystal spec runner.
* Update README.md
2021-01-26 08:38:19 +02:00
Sijawusz Pur Rahnama
6acb8ad2eb
ChainedCallsWithNoBang -> ChainedCallWithNoBang
2021-01-22 17:24:45 +01:00
Sijawusz Pur Rahnama
8babeea80f
Add repeated_combinations
and repeated_permutations
2021-01-22 12:21:14 +01:00
Sijawusz Pur Rahnama
a219a73258
Remove rotate from the list of call_names
...
In some cases it returns `self` and not a copy.
2021-01-22 12:20:50 +01:00
Sijawusz Pur Rahnama
d3b952f58a
Add Performance/ChainedCallsWithNoBang rule
2021-01-21 12:47:10 +01:00
Vitalii Elenhaupt
7aa7efd4bd
Do not report if variable is assigned and referenced in MacroFor/MacroIf/MacroExpression
...
closes #194
2021-01-20 13:14:42 +02:00
Sijawusz Pur Rahnama
ad8f570a04
Change Rule to class
2021-01-19 22:17:17 +01:00
Sijawusz Pur Rahnama
ddaa58f475
Merge pull request #192 from crystal-ameba/feature/flatten-after-map-rule
...
Add Performance/FlattenAfterMap rule
2021-01-19 22:16:10 +01:00
Sijawusz Pur Rahnama
4958fa2315
Merge pull request #184 from mamantoha/fix-crystal-nightly
...
fix Crystal nightly
2021-01-19 13:18:18 +02:00
Sijawusz Pur Rahnama
23b4b4c4f0
Add Performance/FlattenAfterMap rule
2021-01-18 18:04:54 +01:00
Sijawusz Pur Rahnama
b7286dc673
Add Performance/CompactAfterMap rule
2021-01-18 18:04:12 +01:00
Sijawusz Pur Rahnama
d2fa75280f
Extend JoinAfterMap to check also calls to sum/product
and rename it to MapInsteadOfBlock ( #190 )
2021-01-18 17:42:50 +02:00
Vitalii Elenhaupt
e9ec91654c
New Rule: Lint/DuplicatedRequire
...
closes https://github.com/crystal-ameba/ameba/issues/176
2021-01-17 22:32:24 +02:00
Sijawusz Pur Rahnama
6898aa8976
Fix issue #187 ( #189 )
...
* Avoid using `tap` with structs
* Remove extraneous blank lines
* Readability
2021-01-17 22:31:53 +02:00
Sijawusz Pur Rahnama
928a260d51
Remove extraneous blank lines
2021-01-17 18:45:14 +01:00
Sijawusz Pur Rahnama
af5d825015
Followup to #185
2021-01-17 18:45:14 +01:00
Sijawusz Pur Rahnama
fd4b2f309c
Don’t allocate the array on every call
2021-01-17 18:05:08 +01:00
Sijawusz Pur Rahnama
5e58a60ade
Move constant definitions after properties
call
2021-01-17 17:39:32 +01:00
Sijawusz Pur Rahnama
a892cd43b0
Add Performance/JoinAfterMap rule
2021-01-17 16:57:15 +01:00
Sijawusz Pur Rahnama
06852c490b
Followup to #185
2021-01-17 13:25:50 +01:00
Sijawusz Pur Rahnama
1a091c1f1a
Optimize rules ( #185 )
...
* Replace pointless interpolations with actual values
* Rules optimizations
* Stylistic refactors
* Remove extraneous blank lines
* Remove some instances of .not_nil! usage
2021-01-17 14:16:04 +02:00
Sijawusz Pur Rahnama
270a003df6
Merge pull request #184 from mamantoha/fix-crystal-nightly
...
fix Crystal nightly
2021-01-16 19:53:48 +01:00
Anton Maminov
6f0f8352f9
fix Crystal nightly
2021-01-16 20:42:27 +02:00
Sijawusz Pur Rahnama
c4d34d74d8
Add support for showing code context lines ( #181 )
...
* Add support for showing code context lines
* Show context lines only in ExplainFormatter
* Add spec coverage for context_lines option
2021-01-12 17:20:43 +02:00
Sijawusz Pur Rahnama
19c370aee0
Misc refactors ( #180 )
...
* Optimize Severity#symbol
* Remove empty else branches
* Optimize map+compact/flatten calls
* Misc stylistic refactors
2021-01-11 20:13:58 +02:00
Sijawusz Pur Rahnama
2eff832669
Add --rules switch to the CLI
2021-01-09 21:01:04 +01:00
Vitalii Elenhaupt
de3f16a9dc
Disable Lint/EmptyExpression rule
...
closes #169
2020-10-23 19:21:39 +03:00
Vitalii Elenhaupt
44290a6a5d
Handle case when compiler reports incorrect node location
...
fixes #168
2020-10-23 10:41:17 +03:00
Vitalii Elenhaupt
f8d57345d4
Merge branch 'develop'
2020-08-26 22:46:03 +03:00
Vitalii Elenhaupt
b5bd76dfa8
Useless Assign: ignore variables with '_' prefix
...
closes #164
2020-08-20 21:15:58 +03:00
Vitalii Elenhaupt
d650ca5477
Incorrectly reporting shadowingOuterLocalVar within macro included
...
closes #161
2020-07-15 10:18:12 +03:00