* Ignore actual functions in FunctionOnlyReturningConstant (#3388)
* Enable builds for pull requests from grouped branches
* Remove redundant .trimIndent()
Co-authored-by: M Schalk <30376729+schalkms@users.noreply.github.com>
Added new SleepInsteadOfDelay rule for checking for whether Thread.sleep() is being used in suspend functions and coroutines.
* sleep instead of delay
Added SleepInsteadOfDelay rule
* sleep_instead_of_delay
Added entry to mention the new contribution in README.md
* sleep_instead_of_delay
Added positive unit test for SleepInsteadOfDelay rule
* sleep_instead_of_delay
Added check for CoroutineScope.async(); Added @requiresTypeResolution for documentation
* sleep_instead_of_delay
Removing active declaration for rule
* sleep_instead_of_delay
Added test for sleep() invocation when Thread.sleep is imported and executed in a Coroutine block; Fixed bug where sleepImported could be set to false after visiting other import statements in a file
* sleep_instead_of_delay
Reducing granularity of checks for Thread.sleep() invocations, just checking on all KtCallExpression instances
Co-authored-by: M Schalk <30376729+schalkms@users.noreply.github.com>
* Rule improvement: ReturnFromFinally
* Fix class comment
* Changed the order of checks
* Changed the implementation of visitFinallySection with the binding context capability
* Code review fixes
Co-authored-by: ivanov_r <ivanov_r@bifit.com>
Co-authored-by: r.ivanov <r.ivanov@redmadrobot.com>
* Fix rule LibraryCodeMustSpecifyReturnType
False positive: Members without visibility modifiers in an
internal class should not be reported.
False negative: Members with protected modifiers in a public
class should be reported.
* Create BaseRule.lintWithContext to skip KotlinScriptEngine compilation
* Add comment back
* Add @requiresTypeResolution and binding context check
* Complete the javadoc and build
* Add new coroutines rule - SuspendFunWithFlowReturnType
* Run generateDocumentation task
* Add Marcelo Hernandez to Contributors list
* Downgrade Coroutines from 1.3.9 to 1.3.8
* Remove Coroutines dependency declaration in detekt-test-utils
* Reformat CodeSmell instantiation
* Add test for non-suspend, Flow-returning functions
* Delete tests that fail when compile-test-snippets=true
* Revert changes to index.md files
* Add link to specific "Flows are cold" section in Flow documentation
* Extend the issue description by providing the 'why'
* Use apply when adding JvmClasspathRoots in KtTestCompiler
* Update documentation to reflect updated link
* Rename private isCoroutineFlow() extension to isCoroutinesFlow()
* Update issue description
Co-authored-by: Marcelo Hernandez <marcelo.hernandez@gotinder.com>
* Update to Gradle 6.6
* Update to Kotlin 1.4
* Upgrade to prerelease of KtLint 0.38
* Fix testcase by unwrapping the original descriptor
* Increase max heap for dokka on Java 11
* Update minimal supported Gradle version to 5.3
* Do not run warningsAsErrors on CI due to Gradle not supporting Kotlin 1.4
* Remove new line testing as it fails on windows
* Require Gradle 5.4 to reflect Kotlin's required version from their website
* Add new rule: LibraryEntitiesCannotBePublic
* add docs for rule: LibraryEntitiesCannotBePublic
* Update readMe
* Change .hasSize(0) to .isEmpty() in tests
* Fixed code review issues
* Add check for top funtion for rule LibraryEntitiesShouldNotBePublic and fixed detekt issues
* Added LibraryEntitiesShouldNotBePublic to default detekt config
* Fixed naming of test class
* Fixed default detekt config and doc for style
* Remove broken test
* Add new rule UseEmptyCounterpart
* Simplify UseEmptyCounterpartSpec fixture creation
* Add test for no-arg custom function invocation
* Fix failing test for no-arg custom function invocation
* Add test for no-arg instantiation with inferred type parameters
* Add support for empty instantiation of listOfNotNull()
* Fix UseDataClass to accept classes that implement interfaces
* Add test to cover interface property override
* Fix improper code in test
* Add additional tests
* Add myself to the readme contributors
* Rename Blacklist and Whitelist to be self explanatory
SuppressedFalsePositive and TemporarySuppressedIssue describe better what each list is meant for and are more culturally appropriate.
* Add backward compatibility for deprecated baseline attributes
* Use better names for tags that replace blacklist and whitelist
* Define constants for Blacklist and Whitelist
This was done to make it more clear why they still exist in code
* Fix documentation after replacing whitelist terminology
* Move documentation to WildcardRule so generator does not complain
Co-authored-by: Artur Bosch <arturbosch@gmx.de>
* Add style rule for mandatory braces in for loops
* Unify code style in mandatory braces for loop and if statement rules
Extracted the description inside of 'MandatoryBracesIfStatements' to a
constant to match the structure of 'MandatoryBracesForLoops'.
Refactored the helper functions in 'MandatoryBracesIfStatements' to be
extention functions, again similar to 'MandatoryBracesForLoops'.
Refactored extension functions in both to explicitly use this to help
make clear the properties of the receiver.
* Add unit tests to verify MandatoryBracesForLoops
* Add daphil19 to contributors list in readme
* Reorder StyleGuideProvider list to be in alphabetical order
'MandatoryBracesIfStatements' and 'MandatoryBracesForloops' were not in
alphabetical order.
* Refactor MandatoryBracesForLoops tests to use compileAndLint
This change addresses some of the commends in PR #2658.
* Add additonal test to MandatoryBracesForLoops
These tests were mainly edge cases that were requested in PR #2658.
While writing these tests, the actual MandatoryBracesForLoops rule was
modified to add the apporpirate call to `super` in order to handle the
nested loop case
* Add while loop support for MandatoryBracesForLoops
The rule now checks for braces in both for and while loops.
This commit also added unit tests for the while loop portion.
* Rename MandatoryBracesLoops rule
Because the rule now supports both for and while loops, the rule should
be renamed from MandatoryBracesForLoops to MandatoryBracesLoops.
* Fix reference error in test code for MandatoryBracesLoops
One of the while loop tests referenced a var that wasn't present.
* Add a test for loop in if statement for MandatoryBracesLoops
* Update --help output
* Document the different ways to install detekt
* Update how to install the cli in the readme
* Use the current version of detekt in our documentation
* Don't use the java -jar way to run detekt as an example
* fix language metadata
* Emit helpful errors in Gradle plugin
Whenever the plugin is applied to a project that doesn't have
jcenter() configured, the user would get a cryptic error message
from Gradle (see issue #2549). This simple change makes sure the
plugin will provide users with clear instructions on how to fix
their build so they don't get stumped when things don't work.
* Update contributions in README
* Fix ktlint name in docs: it's all lowercase
Also update repo URL to /pinterest/ktlint through out docs
* Update Gradle getting started in index.md
* Fix ktlint name in code too
* Address detekt warnings after plugin changes
* Only check for jCenter in afterEvaluate { }
This is necessary because we need to make sure it's there _somehow_,
and it may be added by other plugins, or blocks evaluated after this
plugin is applied.
* Apply suggestions from code review
Co-Authored-By: M Schalk <30376729+schalkms@users.noreply.github.com>
Co-authored-by: M Schalk <30376729+schalkms@users.noreply.github.com>
* Rule fix: MagicNumber with ignoreNamedArgument and a negative value
* Adding contributor to README.md
* Rule fix: MagicNumber with ignoreNamedArgument and a negative value