Releases: saveourtool/diktat
Release 2.0.0
🥳 🥳 🥳
This is a major release of Diktat, tailored to align with the global changes in the Kotlin ecosystem and the introduction of Kotlin 2.0. Our focus has shifted towards the Kotlin 2.0 compiler plugins, FIR and new IR, encompassing extensive preparatory efforts.
This includes:
- the introduction of a new CLI driver, independent from ktlint;
- transitioning from Maven to Gradle;
- crafting new Gradle and Maven plugins;
- refactoring, including the change of the package name: from
org.cqfn
tocom.saveourtool
; - migrations to latest Kotlin and Ktlint;
- more than 25 fixes, requested by the community.
These initiatives aim to streamline our future development processes, simplifying the creation of new rules, while concurrently enhancing the complexity and precision of existing rules.
Functional changes and bugfixing
- New rule to check if @Preview (Jetpack Compose) functions end with 'Preview' suffix and are also private (Part 1) by @kgevorkyan in #1726
- Extracted
REDUNDANT_SEMICOLON
rule check fromWRONG_NEWLINES
rule by @DrAlexD in #1864 - NPE in NewlinesRule.kt by @diphtongue in #1853
- Provide
fix logic
for @Preview functions by @kgevorkyan in #1728 - Inlined typealias for legacy LintError by @nulls in #1684
- serialVersionUID should be ignored in
CONSTANT_UPPERCASE
by @diphtongue in #1849 - Fixed PreviewAnnotationRule by @nulls in #1740
- Fixed StatelessClassesRule by @nulls in #1741
- Fixed TrailingCommaRule and StringTemplateRuleFixTest by @nulls in #1742
- Fixed CommentsFormatting for else blocks by @nulls in #1743
- Fixed IdentifierNaming by @nulls in #1746
- Fixed KdocMethods by @DrAlexD in #1757
- Fixed IndentationRule by @DrAlexD in #1760
- Fixed KdocComments by @DrAlexD in #1754
- Fixed LineLength by @DrAlexD in #1759
- Fix for a NO_BRACES_IN_CONDITIONALS_AND_LOOPS failure within variable initialization block by @DrAlexD in #1739
- Fixed warning
FUNCTION_BOOLEAN_PREFIX
onoperator fun
by @diphtongue in #1767 - Fixed
KdocComments
for types in generic classes by @DrAlexD in #1832 - Fixed BracesInConditionalsAndLoopsRule and added tests by @DrAlexD in #1750
- Fixed
VARIABLE_NAME_INCORRECT_FORMAT
false positive when a property has a backing field by @diphtongue in #1810 - Fixed bug related to assigning to declared vals inside null-check branches by @DrAlexD in #1851
- Fixed false positive
MISSING_KDOC_ON_FUNCTION
on local function (function inside another function) by @diphtongue in #1848 - Fixed
WRONG_NEWLINES
rule to take into accountmaxCallsInOneLine
by @DrAlexD in #1858 - Fixed
CUSTOM_GETTERS_SETTERS
false positive when a property has a backing field by @diphtongue in #1815 KDOC_WITHOUT_THROWS_TAG
add@throws
annotation when throw inside try-catch by @diphtongue in #1862- Fixed duplicate
@property
generation for parameter with ' in name by @DrAlexD in #1873
New CLI Driver
- Diktat command by @nulls in #1649
- Diktat CLI runner by @nulls in #1653
- Wrap KtLint classes by @nulls in #1648
- Disabled additional rules from KtLint by @nulls in #1643
- Moved Diktat's implementation of KtLint's RuleSetProvider by @nulls in #1654
- Support a full path in DiktatReporter by @nulls in #1798
- Rewrite StreamGobbler by @nulls in #1692
- Return exit code 1 when not all errors are fixed by @nulls in #1868
- Updated arguments for
diktat-cli
by @nulls in #1860 - Fix CLI integration step in README by @Goooler in #1772
- Supported multiple reporters in diktat runner by @nulls in #1803
- Added script for Windows by @nulls in #1859
- Introduced
diktat-runner
by @nulls in #1813 - Fixed diktat-cli by @nulls in #1841
- Make diktat-cli executable by @nulls in #1843
- Use diktat-runner:shadow as variant by @nulls in #1875
New Gradle and Maven plugins
- Fat jar for gradle plugin by @nulls in #1794
- Supported multiple reporters in maven by @nulls in #1824
- Support ANT-like glob patterns by @nulls in #1856
- Fixed maven plugin by @nulls in #1816
Diktat Testing
- Enhance smoke tests by @nulls in #1766
- Enhance tests in diktat by @nulls in #1780
- Fixed smoke tests by @nulls in #1769
- Enhancements for tests by @nulls in #1644
- Moved tests with CLI from GitHub actions to JUnit test by @nulls in #1784
- Remove
diktat-test-framework
by @nulls in #1785
Infra changes
- Migration to Gradle by @nulls in #1625
- Added a placeholder for years by @nulls in #1640
- Diktat API by @nulls in #1655
- Reused 'DiktatProcessor' for inline fix and check by @nulls in #1657
- Migration to Kotlin's imports by @nulls in #1659
- Publish
dependencies
on GitHub by @nulls in #1662, #1663, #1664, #1665 - Removed usage of
GrgitServicePlugin
by @nulls in #1682 - Updating the package name to the new one by @akuleshov7 in #1687
- Diktat rule configs by @nulls in #1686
- Removed close outputStream as separate listener by @nulls in #1688
- Refactored
warn
andwarnAndFix
inWarnings
by @nulls in #1751 - Migration to new package in Maven Central by @nulls in #1744
- Migrated smoke test to diktat cli by @nulls in #1782
- Fix release to maven central by @nulls in #1788
- Supported release to plugins.gradle.org by @nulls in #1789
- Fixed step.id by @nulls in #1790
- Support configuration of reporters in DSL by @nulls in #1808
- Remove dependency to mockito-all by @nulls in #1811
- Fix mergeDiktatReports by @nulls in #1812
- Avoid changing newlines by @nulls in #1830
- Added shadow for diktat-runner by @nulls in #1834
- Support running diktat without configuration by @nulls in #1837
- Refactor
fun isPairPropertyBackingField
usingPSI
by @diphtongue in #1857 - Fixed release.yml by @nulls in #1861
- Rewrote adoc to markdown by @nulls in #1867
- Support virtual path in DiktatProcessor by @nulls in #1874
Dependencies Updates
- Update Kotlin and core dependencies to v1.9.21 by @renovate in #1651, #1669, #1870, #1763.
- Update Ktlint to v1.0.1 by @renovate in #1683, #1729, #1763
- Update all non-major dependencies (except core Kotlin) to v6.18.0 by @renovate in #1652, v8.2 by @renovate in #1704, v8.2.1 by @renovate in https://github.com/saveourtool/diktat/p...
Release v2.0.0-rc.8
release candidate 2.0.0
Release 1.2.5
What's Changed
- Update versions in pom.xml and documentation after 1.2.4.2 release by @github-actions in #1567
- update README.md for JDK 16+ issues by @agebhar1 in #1573
- Migration to sarif4j:0.3.0 by @nulls in #1577
- Enabled functionalTest in gradle plugin by @nulls in #1579
- Update dependency gradle to v7.6 by @renovate in #1581
- block version of kaml-jvm by @nulls in #1580
- Update all non-major dependencies (except core Kotlin) by @renovate in #1574
- Update Kotlin core dependencies to v1.7.22 by @renovate in #1582
- Update dependency org.apache.maven.plugins:maven-dependency-plugin to v3.4.0 by @renovate in #1583
- Update plugin org.gradle.test-retry to v1.5.0 by @renovate in #1584
- Fix diktat:fix by @nulls in #1585
- Update dependency org.codehaus.mojo:versions-maven-plugin to v2.14.1 by @renovate in #1590
- Fix the build status badge to show status from the
master
branch by @0x6675636b796f75676974687562 in #1591 - Update dependency org.codehaus.mojo:versions-maven-plugin to v2.14.2 by @renovate in #1592
- Update Demo link by @kgevorkyan in #1603
- Fixed WRONG_MULTIPLE_MODIFIERS_ORDER bug in SAM interface by @Cheshiriks in #1601
- Fixed CONSTANT_UPPERCASE doesn't handle number in middle name by @Cheshiriks in #1604
- Update plugin org.gradle.test-retry to v1.5.1 by @renovate in #1599
- Update Kotlin core dependencies to v1.8.0 by @renovate in #1596
- EMPTY_BLOCK_STRUCTURE_ERROR: is not raised on empty when block by @Cheshiriks in #1605
- CUSTOM_GETTERS_SETTERS false positive on the override of fields by @Cheshiriks in #1606
- BLANK_LINE_BETWEEN_PROPERTIES false positive by @Cheshiriks in #1608
- Update dependency gradle to v7.6.1 by @renovate in #1613
- Update plugin org.gradle.test-retry to v1.5.2 by @renovate in #1614
- Handling a package directive when nodes are moved by @nulls in #1616
- False positive with single expression functions that use multiple return keywords by @Cheshiriks in #1617
- Update all non-major dependencies (except core Kotlin) by @renovate in #1595
- Update Kotlin core dependencies to v1.8.10 by @renovate in #1610
- False positive WRONG_OVERLOADING_FUNCTION_ARGUMENTS by @icemachined in #1623
- loggers sometimes shouldn't be first by @sanyavertolet in #1624
- Ignore
external
interfaces when triggeringEXTENSION_FUNCTION_WITH_CLASS
by @0x6675636b796f75676974687562 in #1630 - Upgrade
com.github.gantsign.maven.plugin-tools:kotlin-maven-plugin-tools
by @0x6675636b796f75676974687562 in #1633 - Limit the maximum Maven Plug-in API version to be at most 3.6.4 by @0x6675636b796f75676974687562 in #1634
New Contributors
Full Changelog: v1.2.4.2...v1.2.5
Release 1.2.4.2
Release 1.2.4.1
What's Changed
- Update versions in pom.xml and documentation after 1.2.2 release by @github-actions in #1483
- gradle-plugin: fix incorrect dependencies related to
SarifReportMergeTask
by @petertrr in #1485 - Properly format expressions wrapped before a binary operator by @0x6675636b796f75676974687562 in #1486
- gradle-plugin: treat SarifReportMergeTask as non-mandatory by @petertrr in #1487
Full Changelog: v1.2.2...v1.2.4.1
Release 1.2.4
NOT STABLE RELEASE DUE TO PROBLEMS WITH KTLINT, USE 1.2.4.2 INSTEAD
What's Changed
- Update versions in pom.xml and documentation after 1.2.3 release by @github-actions in #1488
- Update dependency gradle to v7.5.1 by @renovate in #1455
- Silently overwrite
diktat.jar
if the previous copy already exists by @0x6675636b796f75676974687562 in #1498 - Maven: enable the Surefire tree reporter & color output by @0x6675636b796f75676974687562 in #1497
- Update Kotlin core dependencies to v1.7.10 by @renovate in #1436
- Update all non-major dependencies (except core Kotlin) to v3.1.0 by @renovate in #1454
- Make writing tests for
WRONG_INDENTATION
checks easier by @0x6675636b796f75676974687562 in #1499 - Rewrite
WRONG_INDENTATION
unit tests using the new test infrastructure by @0x6675636b796f75676974687562 in #1500 WRONG_INDENTATION
: add the test which reproduces the regression by @0x6675636b796f75676974687562 in #1501WRONG_INDENTATION
: fix the regression introduced with 998d0e9 by @0x6675636b796f75676974687562 in #1503- Update all non-major dependencies (except core Kotlin) by @renovate in #1507
- Update dependency com.rudikershaw.gitbuildhook:git-build-hook-maven-plugin to v3.3.0 by @renovate in #1512
- Update dependency com.bpodgursky:jbool_expressions to v1.24 by @renovate in #1515
- Update plugin org.gradle.test-retry to v1.4.1 by @renovate in #1514
- Migrated DistributiveLaw to jbool implementation by @nulls in #1513
WRONG_ORDER_IN_CLASS_LIKE_STRUCTURES
: fix the IOOBE by @0x6675636b796f75676974687562 in #1519- Add docs on
RANGE_TO_UNTIL
rule by @petertrr in #1525 - Only apply
RANGE_TO_UNTIL
rule if right-hand side of..
containsX-1
by @petertrr in #1524 - WRONG_OVERLOADING_FUNCTION_ARGUMENTS: adding exceptions to the rule by @akuleshov7 in #1520
- Fix assertion failed in rule [kdoc-formatting] #1489 by @icemachined in #1522
- Fix simplification of boolean expression by @nulls in #1523
- SAVE smoke tests should not have fixed line numbers by @Cheshiriks in #1528
- Update Kotlin core dependencies to v1.7.20 by @renovate in #1531
- Update all github actions (major) by @renovate in #1533
- Removed log for checking name of srcDirectories by @Cheshiriks in #1536
- Bugfix for fix mode of
AVOID_NULL_CHECK
by @sanyavertolet in #1535 - Added trim() for list of string test directories by @Cheshiriks in #1537
- Update Ktlint to v0.47.1 by @renovate in #1506
- Smoke tests in diktat by @nulls in #1534
- Update all non-major dependencies (except core Kotlin) by @renovate in #1518
- Avoid overriding the deprecated
Rule#visit()
call by @0x6675636b796f75676974687562 in #1541 - Leave
consoleOutputReporter
enabled formaven-failsafe-plugin
by @0x6675636b796f75676974687562 in #1542 - Run Diktat from CLI using glob (**/*) paths by @0x6675636b796f75676974687562 in #1544
- Update dependency io.github.microutils:kotlin-logging-jvm to v3 by @renovate in #1529
- Properly indent comments inside multi-line Elvis expressions by @0x6675636b796f75676974687562 in #1545
- Upgrade
MicroUtils/kotlin-logging
to 3.0.4 by @0x6675636b796f75676974687562 in #1552 - Make
DiktatRuleSetProvider#get()
lazy by @0x6675636b796f75676974687562 in #1553 - Warn if param or property in kdoc present several times by @kgevorkyan in #1547
- Fix the race condition introduced with 3470888 by @0x6675636b796f75676974687562 in #1555
Full Changelog: v1.2.3...v1.2.4
Release 1.2.3
What's Changed
Gradle plug-in
- Fix incorrect dependencies related to
SarifReportMergeTask
by @petertrr in #1485 - Treat
SarifReportMergeTask
as non-mandatory by @petertrr in #1487
Indentation rule
- The indentation in binary expressions wrapped before a binary operator
or an infix function is also controlled withextendedIndentAfterOperators
(@0x6675636b796f75676974687562, #1340). - The above is also true for
in
,!in
,is
,!is
, and cast (as
andas?
) operators (examples). - The only binary operator which is an exception to the above rule is the Elvis operator (
?:
).
Full Changelog: v1.2.2...v1.2.3
Release 1.2.2
What's Changed
Rules
Data classes
- Hotfix for Data Classes rule by @akuleshov7 in #1445
- Data class rule: removing several cases from the scope of the inspection by @akuleshov7 in #1471
Indentation
- Aligned chained method calls (dot-qualified and safe-access expressions) are no longer reported as false positives (#1336).
- A separate
extendedIndentForExpressionBodies
flag has been added, defaulting tofalse
(#1443).
The flag controls whether continuation indent is used to indent expression bodies
(previously, controlled withextendedIndentAfterOperators
). The corresponding 3rd party flags are:- IDEA:
CONTINUATION_INDENT_FOR_EXPRESSION_BODIES
, .editorconfig
:ij_kotlin_continuation_indent_for_expression_bodies
.
- IDEA:
- The
extendedIndentAfterOperators
flag now defaults totrue
to be consistent with IDEA (#1447). - Within expressions, the indent after an opening parenthesis
(
followed by a newline is now controlled by theextendedIndentAfterOperators
flag (#1448)
KDoc
- Add
@property
,@receiver
, and@exception
to the list of essential tags by @0x6675636b796f75676974687562 in #1468
Comments
- Don't reformat indent-style comments by @0x6675636b796f75676974687562 in #1441
- Correct the (sometimes meaningless) message in the
COMMENT_WHITE_SPACE
check by @0x6675636b796f75676974687562 in #1466
Gradle plug-in
- gradle-plugin: target Kotlin runtime 1.6 by @petertrr in #1419
- gradle-plugin: Set
user.home
property if SARIF reporter is active by @petertrr in #1426 - gradle-plugin: fix docs and tests for Groovy DSL by @petertrr in #1428
- [gradle-plugin] use empty string as default value for reporter type by @petertrr in #1458
- gradle-plugin: add task to merge sarif reports by @petertrr in #1456
Known issues
- After the upgrade to version 1.2.2, Gradle plug-in requires the
:mergeDiktatReports
task to be present (#1484).
Documentation
- Update available-rules.md by @vtchem in #1417
- Update guide-TOC.md by @vtchem in #1431
- Update guide-chapter-0.md by @vtchem in #1430
- Update guide-chapter-1.md by @vtchem in #1432
- README typo fix by @PhilipDukhov in #1453
- Get rid of the collapsible blocks in the CLI usage section by @0x6675636b796f75676974687562 in #1427
- Correct the rule description by @0x6675636b796f75676974687562 in #1467
Infrastructure
- Hotfix for CodeQl build by @akuleshov7 in #1429
- Migrate diktat smoke tests to SAVE-cli mechanism by @Cheshiriks in #1388
- Update metrics workflow fails after SAVE has been integrated by @Cheshiriks in #1463
- Update versions in pom.xml and documentation after 1.2.1 release by @github-actions in #1418
- Update all non-major dependencies (except core Kotlin) by @renovate in #1421
- Update dependency org.apache.maven.plugins:maven-assembly-plugin to v3.4.1 by @renovate in #1437
- Update renovate.json by @petertrr in #1460
- Update the version in
examples/maven/pom.xml
after the release by @0x6675636b796f75676974687562 in #1440 - Add
gradle-kotlin-dsl-multiproject
to the list of example projects by @0x6675636b796f75676974687562 in #1446 - Add the default value of
extendedIndentBeforeDot
todiktat-analysis.yml
by @0x6675636b796f75676974687562 in #1449 - Allow PR's to succeed even if authored by non-collaborators by @0x6675636b796f75676974687562 in #1459
- Add the retry logic and diagnostics to
DiktatSaveSmokeTest
by @0x6675636b796f75676974687562 in #1477 - Fix the missing fat JAR problem during the release procedure by @0x6675636b796f75676974687562 in #1479
- Improve
JAVA_HOME
comparison for forked tests by @0x6675636b796f75676974687562 in #1480 - Remove the circular dependency between
diktat-rules
anddiktat-ruleset
by @0x6675636b796f75676974687562 in #1481 - Simplify Maven configuration by running
DiktatSaveSmokeTest
as an integration test by @0x6675636b796f75676974687562 in #1482
Full Changelog: v1.2.1...v1.2.2
Release 1.2.1
Read first
This is minor release that contains bugfixes that we introduced in a dirty 1.2.0 release
Important: in 1.2.0 release we proposed breaking changes, especially related to whitespaces and newlines.
Critical bugfixes
- Temporary removing K2 compiler Frontend by @akuleshov7 in #1405
- Logging changed by @petertrr in #1414
- Don't separate fully-qualified expressions as a regular
dot qualified expression
by @Arrgentum in #1411
What's Changed
- Minor documentation fixes by @akuleshov7 in #1332
WRONG_INDENTATION
: add more tests forextendedIndentAfterOperators
by @0x6675636b796f75676974687562 in #1401- Update dependency com.charleskorn.kaml:kaml-jvm to v0.46.0 by @renovate in #1402
- Don't change the indent for parentheses-enclosed expressions by @0x6675636b796f75676974687562 in #1410
- Bugfix: Checking white space before opening brace that starts a line by @petertrr in #1354
- Bugfixing of single binary expression wrapped in parentheses (long lines rule) by @Arrgentum in #1416
Full Changelog: v1.2.0...v1.2.1
Release 1.2.0
Read first
Important: due to the bugfixes done in IntelliJ Idea formatter we finally removed several our workarounds, so whitespace/newlines formatting was slightly changed and code style updated. You can easily use FIX
in diktat or our specially prepared .editorconfig to update formatting. This is why this release is not a patch, but has a minor version.
New features
- Diktat moved to Kotlin 1.7.0 and ktlint 0.46.1 by @nulls in #1357
- Adding new logic for suppressing inspection by @akuleshov7 in #1328
- Add
.editorconfig
which conforms to the Kotlin style guide by @0x6675636b796f75676974687562 in #1348 - DebugPrintRule by @nulls in #1314
- New Rule COMMENTS_BY_KDOC was implemented by @icemachined in #1350
- Support DistributiveLaw as jbool.Rule by @nulls in #1369
Bugfixes
- Unsigned integer literal is perhaps incorrectly marked as a MAGIC_NUMBER by @Cheshiriks in #1276
- Delete all set of in descriptions of rule classes by @Arrgentum in #1273
- Configure Renovate by @renovate in #1277
- Fix logic "BinaryExpression" in "LineLength" Rule by @Arrgentum in #1292
- Fixed build on Unix by @nulls in #1296
- BooleanExpressionRule fixes by @nulls in #1295
- Enhance
examples/maven/pom.xml
with a doc comment by @unix-junkie in #1298 - Refactor
DiktatMavenPluginIntegrationTest
to ease troubleshooting in case of test failures by @unix-junkie in #1304 - Correctred NAME_ID by @Arrgentum in #1306
- Reused c.p.k.c.Rule.VisitorModifier.RunAfterRule by @nulls in #1310
- Supported comments after latest enum element by @nulls in #1302
- Rename
s/analysis-dev/saveourtool/g
in URLs by @unix-junkie in #1311 - Also set the default value of
extendedIndentOfParameters
tofalse
if there's no config file by @0x6675636b796f75676974687562 in #1329 - Typos in DEBUG_PRINT by @nulls in #1338
- NullPointerException on KDOC inspection by @Cheshiriks in #1334
- Set the default values of
extendedIndentAfterOperators
andextendedIndentBeforeDot
tofalse
by @0x6675636b796f75676974687562 in #1342 - Prohibit the use of *-imports via
.editorconfig
by @0x6675636b796f75676974687562 in #1353 - Enforce the import order consistent with the project policy by @0x6675636b796f75676974687562 in #1355
- Bugfix/new lines rule dot qualified expression and safe access expression by @Arrgentum in #1337
- Add unit tests for mis-indented expression body functions by @0x6675636b796f75676974687562 in #1363
- Bugfix/long line in string template by @Arrgentum in #1297
- Fix for NSFE when mvn test run from /diktat-rules by @nulls in #1366
- Fix for NSFE when mvn test run from /diktat-rules: follow up by @nulls in #1367
- Bugfix/indentation of multiline string by @Arrgentum in #1364
- Report unit test results via GitHub Actions by @0x6675636b796f75676974687562 in #1370
- Fix for UNUSED_IMPORT in KDoc by @nulls in #1368
- Add unit tests which reproduce #1347 by @0x6675636b796f75676974687562 in #1371
- Clean up the code by @0x6675636b796f75676974687562 in #1376
- Stop using
DEFAULT_INDENT_SIZE
directly by @0x6675636b796f75676974687562 in #1382 - Bugfix/fix cause long line by @Arrgentum in #1373
- Adding new
macosArm64
target for inspection by @akuleshov7 in #1386 - Indent only
TEMPLATE_ENTRY
nodes immediately following a newline by @0x6675636b796f75676974687562 in #1387 - Corrected analysis if maximum lineLength drop in first symbol of the last word long binary expression by @Arrgentum in #1389
- Fix ordering issue by @nulls in #1390
- Add more integration tests for
extendedIndentAfterOperators
flag by @0x6675636b796f75676974687562 in #1395 - Added this operator references to the list with similar operator references by @Arrgentum in #1393
New Contributors
- @maugagneur made their first contribution in #1289
- @unix-junkie (@0x6675636b796f75676974687562) made their first contribution in #1298
- @icemachined made their first contribution in #1350
Full Changelog: v1.1.0...v1.2.0