Sijawusz Pur Rahnama
8e86374d08
Remove outdated spec
2023-01-10 13:10:05 +01:00
Sijawusz Pur Rahnama
d31e41b8a7
Fix specs on Crystal nightly (soon to be v1.7.0)
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
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
232c16d743
Add spec for 10000
Int128
literal in Style/LargeNumbers
2022-12-21 21:15:17 +01:00
Sijawusz Pur Rahnama
cfea0fda34
Fix typo
2022-12-21 21:14:29 +01:00
Sijawusz Pur Rahnama
9926f0295a
Remove most of the obsolete specs
2022-12-21 21:13:22 +01:00
Sijawusz Pur Rahnama
1ba6fcb55c
Enhance spec helpers a bit in re: to the spec context
2022-12-21 17:34:17 +01:00
Sijawusz Pur Rahnama
e9f3bbaeff
Fail with the additional context
2022-12-21 17:34:10 +01:00
Sijawusz Pur Rahnama
7c617b5a7b
Make spec helper methods private
2022-12-21 17:34:05 +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
d7154ad6d2
Fix failing spec
2022-12-20 04:10:56 +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
70078cf77f
Synchronize properties context names in rules’ specs
2022-12-20 03:25:10 +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
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
9df66e890b
Do not report anonymous block arguments in Lint/UnusedArgument
2022-12-12 18:21:19 +01:00
Sijawusz Pur Rahnama
99c81d3630
Add spec for positive case in macro scope in Lint/LiteralsComparison
rule
2022-12-09 23:53:39 +01:00
Sijawusz Pur Rahnama
2fb453c61f
Add additional spec for Lint/NotNil
rule
2022-12-08 17:47:22 +01:00
Sijawusz Pur Rahnama
7d88455b7f
Add corrector to the Style/IsANil
rule
2022-12-08 13:58:35 +01:00
Sijawusz Pur Rahnama
071a8b7afb
Consistently use CRYSTAL
marker for heredocs with crystal code
2022-12-08 13:57:46 +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
e18da84ede
Add requested spec
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
33ef9c6293
Refactor ExplainFormatter
2022-11-28 11:38:41 +01:00
Sijawusz Pur Rahnama
38eb5d5e50
Fix invalid crystal syntax in Lint/Syntax
rule spec
2022-11-23 03:26:55 +01:00
Sijawusz Pur Rahnama
2c67fe2c3f
Use tuple instead of an array
2022-11-23 03:23:42 +01:00
Sijawusz Pur Rahnama
60813e4899
Test generated boolean rule property
2022-11-22 19:53:27 +01:00
Sijawusz Pur Rahnama
9f670c09b5
Refactor TODOFormatter
spec
2022-11-22 19:52:32 +01:00
Sijawusz Pur Rahnama
c7c75ee36a
Rule#enabled
-> Rule#enabled?
2022-11-22 19:47:37 +01:00
Sijawusz Pur Rahnama
6bd18f9cbf
Fix typo
2022-11-22 19:43:52 +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
0b0a815c31
Add additional test case
2022-11-18 07:04: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
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
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
2fb37da80f
Refactor AST::Util#literal?
helper
2022-11-15 17:42:08 +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
52bf0a5be4
Refactor Style/PredicateName
rule
...
Do not report `has_<name>?` method names
2022-11-13 20:12:23 +01:00
Vitalii Elenhaupt
2811352cae
Merge pull request #298 from crystal-ameba/Sija/fix-specs-on-crystal-nightly
...
Fix specs on Crystal nightly
2022-11-13 21:07:29 +02:00
Sijawusz Pur Rahnama
5f46612e89
Remove obsolete spec
2022-11-13 01:32:49 +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
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
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
ffc712a838
Reduce usage of Object#not_nil!
2022-10-29 00:03:39 +02:00
Vitalii Elenhaupt
60bf8e13ce
fix(style): properly tokenize in RedundantBegin rule
2022-10-14 21:09:30 +03: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
20db75a54a
Fix typo in UnneededDisableDirective
rule spec filename
2022-04-04 22:30:23 +02:00
Sijawusz Pur Rahnama
48d0089d23
Add some whitespaces for readability
2022-04-04 22:17:41 +02:00
Sijawusz Pur Rahnama
306bc34019
Use issue expectation helpers in Performance::FirstLastAfterFilter
rule spec
2022-04-04 22:17:13 +02:00
Sijawusz Pur Rahnama
119e20d5e5
Use issue expectation helpers in Performance::SizeAfterFilter
rule spec
2022-04-04 22:17:02 +02:00
Sijawusz Pur Rahnama
e0867c04b0
Use issue expectation helpers in Performance::MapInsteadOfBlock
rule spec
2022-04-04 22:16:48 +02:00
Sijawusz Pur Rahnama
6f30881ae6
Use issue expectation helpers in Performance::FlattenAfterMap
rule spec
2022-04-04 22:16:37 +02:00
Sijawusz Pur Rahnama
931dc3d2dc
Use issue expectation helpers in Performance::CompactAfterMap
rule spec
2022-04-04 22:16:21 +02:00
Sijawusz Pur Rahnama
b54f0f0738
Use issue expectation helpers in Metrics::CyclomaticComplexity
rule spec
2022-04-04 22:15:43 +02:00
Sijawusz Pur Rahnama
8a37d5bbe2
Use issue expectation helpers in Layout::LineLength
rule spec
2022-04-04 22:15:07 +02:00
Sijawusz Pur Rahnama
390b26d7f1
Use issue expectation helpers in Lint::AmbiguousAssignment
rule spec
2022-04-04 21:32:46 +02:00
Sijawusz Pur Rahnama
caeb1609c9
Use issue expectation helpers in Lint::BadDirective
rule spec
2022-04-04 21:27:04 +02:00
Sijawusz Pur Rahnama
5283ae4a96
Use issue expectation helpers in Lint::EmptyLoop
rule spec
2022-04-04 21:23:17 +02:00
Sijawusz Pur Rahnama
3cbb388393
Use issue expectation helpers in Lint::HashDuplicatedKey
rule spec
2022-04-04 21:20:13 +02:00
Sijawusz Pur Rahnama
18316eaa8b
Use issue expectation helpers in Lint::LiteralInInterpolation
rule spec
2022-04-04 21:16:48 +02:00
Sijawusz Pur Rahnama
7f85434c85
Use issue expectation helpers in Lint::RandZero
rule spec
2022-04-04 21:14:45 +02:00
Sijawusz Pur Rahnama
c58d4cc65a
Use issue expectation helpers in Lint::Syntax
rule spec
2022-04-04 21:11:04 +02:00
Sijawusz Pur Rahnama
c89d32fcf6
Use issue expectation helpers in Lint::UselessConditionInWhen
rule spec
2022-04-04 21:11:04 +02:00
Sijawusz Pur Rahnama
c8daaf4324
Use issue expectation helpers in Lint::UnneededDisableDirective
rule spec
2022-04-04 21:10:54 +02:00
Sijawusz Pur Rahnama
614fcfa6a8
Skip macro scopes in ShadowingOuterLocalVar
2022-04-04 01:38:04 +02:00
Sijawusz Pur Rahnama
ad5d56b313
Use issue expectation helpers in ShadowingOuterLocalVar
spec
2022-04-04 01:30:27 +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
1f4dda1c4a
Add conditional check using semantic version
2022-04-03 20:16:00 +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
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
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
Johannes Müller
63bafba72e
Fix unexpected token compiler error match
2021-11-29 22:04:59 +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 ⌃ ⌥
d06812ea8e
Add VariableNames
test for method with multiple instance vars
2021-11-09 11:52:31 -08: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 ⌃ ⌥
bd1a1a1fd4
Shorten long line in Stye/VerboseBlock
spec
2021-11-09 09:07:19 -08:00
fn ⌃ ⌥
b32b00adad
Convert remaining Style
specs
2021-11-08 14:24:11 -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 ⌃ ⌥
265bc51481
Convert Style/UnlessElse
spec
2021-11-08 14:07:35 -08:00
fn ⌃ ⌥
06c0887136
Convert Style/TypeNames
spec
2021-11-08 14:07:35 -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
fn ⌃ ⌥
78071722c4
Rename s
to source
2021-11-01 08:55:48 -07:00
fn ⌃ ⌥
c2aa2fedb6
Return source
from expect_issue
2021-10-31 22:44:48 -07:00
fn ⌃ ⌥
437584f9db
Raise error if infinite correction loop
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 ⌃ ⌥
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
Sijawusz Pur Rahnama
651f70f680
Update spec/ameba/ast/visitors/counting_visitor_spec.cr
2021-06-05 20:49:00 +02: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
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
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
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
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
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