Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename s/analysis-dev/saveourtool/g in URLs #1311

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/diktat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ jobs:
git fetch --tags
LATEST_TAG=$(git describe --tags --abbrev=0)
DIKTAT_CONFIG=diktat-analysis.yml
wget -O $DIKTAT_CONFIG https://raw.githubusercontent.com/cqfn/diKTat/$LATEST_TAG/$DIKTAT_CONFIG
wget -O $DIKTAT_CONFIG https://raw.githubusercontent.com/saveourtool/diKTat/$LATEST_TAG/$DIKTAT_CONFIG
- name: Run diktat via maven plugin
run: mvn -B diktat:check@diktat -DskipPluginMarker
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<img src="/logo.svg" width="64px"/>

![Build and test](https://github.com/cqfn/diKTat/workflows/Build%20and%20test/badge.svg)
![deteKT static analysis](https://github.com/cqfn/diKTat/workflows/Run%20deteKT/badge.svg)
![diKTat code style](https://github.com/cqfn/diKTat/workflows/Run%20diKTat%20from%20release%20version/badge.svg?branch=master)
[![codecov](https://codecov.io/gh/analysis-dev/diKTat/branch/master/graph/badge.svg)](https://codecov.io/gh/analysis-dev/diKTat)
![Build and test](https://github.com/saveourtool/diKTat/workflows/Build%20and%20test/badge.svg)
![deteKT static analysis](https://github.com/saveourtool/diKTat/workflows/Run%20deteKT/badge.svg)
![diKTat code style](https://github.com/saveourtool/diKTat/workflows/Run%20diKTat%20from%20release%20version/badge.svg?branch=master)
[![codecov](https://codecov.io/gh/saveourtool/diKTat/branch/master/graph/badge.svg)](https://codecov.io/gh/saveourtool/diKTat)

[![Releases](https://img.shields.io/github/v/release/cqfn/diKTat)](https://github.com/cqfn/diKTat/releases)
[![Releases](https://img.shields.io/github/v/release/saveourtool/diKTat)](https://github.com/saveourtool/diKTat/releases)
[![Maven Central](https://img.shields.io/maven-central/v/org.cqfn.diktat/diktat-rules)](https://mvnrepository.com/artifact/org.cqfn.diktat)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fcqfn%2FdiKTat.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fcqfn%2FdiKTat?ref=badge_shield)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fsaveourtool%2FdiKTat.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fsaveourtool%2FdiKTat?ref=badge_shield)
[![Chat on Telegram](https://img.shields.io/badge/Chat%20on-Telegram-brightgreen.svg)](https://t.me/diktat_help)

[![Hits-of-Code](https://hitsofcode.com/github/cqfn/diktat)](https://hitsofcode.com/view/github/cqfn/diktat)
![Lines of code](https://img.shields.io/tokei/lines/github/cqfn/diktat)
![GitHub repo size](https://img.shields.io/github/repo-size/cqfn/diktat)
[![Hits-of-Code](https://hitsofcode.com/github/saveourtool/diktat)](https://hitsofcode.com/view/github/saveourtool/diktat)
![Lines of code](https://img.shields.io/tokei/lines/github/saveourtool/diktat)
![GitHub repo size](https://img.shields.io/github/repo-size/saveourtool/diktat)
[![Awesome Kotlin Badge](https://kotlin.link/awesome-kotlin.svg)](https://github.com/KotlinBy/awesome-kotlin)


Expand Down Expand Up @@ -56,11 +56,11 @@ Main features of diktat are the following:
curl -sSLO https://github.com/pinterest/ktlint/releases/download/0.43.2/ktlint && chmod a+x ktlint
```

2. Load diKTat manually: [here](https://github.com/cqfn/diKTat/releases/download/v1.1.0/diktat-1.1.0.jar)
2. Load diKTat manually: [here](https://github.com/saveourtool/diKTat/releases/download/v1.1.0/diktat-1.1.0.jar)

**OR** use curl:
```bash
$ curl -sSLO https://github.com/cqfn/diKTat/releases/download/v1.1.0/diktat-1.1.0.jar
$ curl -sSLO https://github.com/saveourtool/diKTat/releases/download/v1.1.0/diktat-1.1.0.jar
```
</details>

Expand All @@ -87,7 +87,7 @@ export MAVEN_OPTS="--add-opens java.base/java.util=ALL-UNNAMED"
```

This plugin is available since version 0.1.3. You can see how it is configured in our project for self-checks: [pom.xml](pom.xml).
If you use it and encounter any problems, feel free to open issues on [github](https://github.com/cqfn/diktat/issues).
If you use it and encounter any problems, feel free to open issues on [github](https://github.com/saveourtool/diktat/issues).

<details>
<summary>Add this plugin to your pom.xml:</summary>
Expand Down
2 changes: 1 addition & 1 deletion diktat-common/src/test/resources/test-rules-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
enabled: true
configuration:
newlineAtEnd: true
extendedIndentOfParameters: true
extendedIndentOfParameters: false
alignedParameters: true
extendedIndentAfterOperators: true
indentationSize: 4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ open class DiktatJavaExecTaskBase @Inject constructor(
val javaVersion = getJavaExecJvmVersion()
project.logger.debug("For diktat execution jvm version $javaVersion will be used")
if (javaVersion.majorVersion.toInt() >= MIN_JVM_REQUIRES_ADD_OPENS) {
// https://github.com/analysis-dev/diktat/issues/1182#issuecomment-1023099713
// https://github.com/saveourtool/diktat/issues/1182#issuecomment-1023099713
project.logger.debug("Adding `--add-opens` flag for JVM version >=$MIN_JVM_REQUIRES_ADD_OPENS compatibility")
jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ abstract class DiktatRule(
logic(node)
} catch (internalError: Throwable) {
log.error(
"""Internal error has occurred in rule [$id]. Please make an issue on this bug at https://github.com/cqfn/diKTat/.
"""Internal error has occurred in rule [$id]. Please make an issue on this bug at https://github.com/saveourtool/diKTat/.
As a workaround you can disable these inspections in yml config: <$inspections>.
Root cause of the problem is in [${node.getFilePath()}] file.
""".trimIndent(), internalError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class NewlinesRule(configRules: List<RulesConfig>) : DiktatRule(

private fun checkForComplexExpression(node: ASTNode) {
if (node.getRootNode().getFilePath().isGradleScript()) {
// this inspection is softened for gradle scripts, see https://github.com/analysis-dev/diktat/issues/1148
// this inspection is softened for gradle scripts, see https://github.com/saveourtool/diktat/issues/1148
return
}
COMPLEX_EXPRESSION.warn(configRules, emitWarn, isFixMode, node.text, node.startOffset, node)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class SmartCastRule(configRules: List<RulesConfig>) : DiktatRule(
}

if (node.elementType == WHEN) {
// Rule is simplified after https://github.com/analysis-dev/diktat/issues/1168
// Rule is simplified after https://github.com/saveourtool/diktat/issues/1168
return
}
}
Expand Down
2 changes: 1 addition & 1 deletion diktat-rules/src/main/resources/diktat-analysis-huawei.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
# Is newline at the end of a file needed
newlineAtEnd: true
# If true: in parameter list when parameters are split by newline they are indented with two indentations instead of one
extendedIndentOfParameters: true
extendedIndentOfParameters: false
# If true: if first parameter in parameter list is on the same line as opening parenthesis, then other parameters can be aligned with it
alignedParameters: true
# If true: if expression is split by newline after operator like +/-/`*`, then the next line is indented with two indentations instead of one
Expand Down
2 changes: 1 addition & 1 deletion diktat-rules/src/main/resources/diktat-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
# Is newline at the end of a file needed
newlineAtEnd: true
# If true: in parameter list when parameters are split by newline they are indented with two indentations instead of one
extendedIndentOfParameters: true
extendedIndentOfParameters: false
# If true: if first parameter in parameter list is on the same line as opening parenthesis, then other parameters can be aligned with it
alignedParameters: true
# If true: if expression is split by newline after operator like +/-/`*`, then the next line is indented with two indentations instead of one
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,19 +396,19 @@ class IndentationRuleWarnTest : LintTestBase(::IndentationRule) {
"""
|fun foo() {
| consume(Example(
| t1, t2, t3
| t1, t2, t3
| ))
|
| bar(baz(
| 1,
| 2
| 1,
| 2
| )
| )
|
| bar(baz(
| 1,
| 2),
| 3
| 1,
| 2),
| 3
| )
|}
|
Expand Down Expand Up @@ -484,15 +484,15 @@ class IndentationRuleWarnTest : LintTestBase(::IndentationRule) {
"""
|fun foo() {
| bar(
| param1 = baz(
| 1,
| 2
| ),
| param2 = { elem ->
| elem.qux()
| },
| param3 = x
| .y()
| param1 = baz(
| 1,
| 2
| ),
| param2 = { elem ->
| elem.qux()
| },
| param3 = x
| .y()
| )
|}
|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class SmartCastRuleWarnTest : LintTestBase(::SmartCastRule) {
}

@Test
@Disabled("Rule is simplified after https://github.com/analysis-dev/diktat/issues/1168")
@Disabled("Rule is simplified after https://github.com/saveourtool/diktat/issues/1168")
@Tag(SMART_CAST_NEEDED)
fun `smart cast in when bad`() {
lintMethod(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class RulesConfigValidationTest {
}

@Test
@Disabled("https://github.com/cqfn/diKTat/issues/395")
@Disabled("https://github.com/saveourtool/diKTat/issues/395")
fun `should throw error on invalid configuration section`() {
file.writeText(
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import com.pinterest.ktlint.core.KtLint
import com.pinterest.ktlint.core.LintError
import com.pinterest.ktlint.core.Rule
import com.pinterest.ktlint.core.api.FeatureInAlphaState
import org.intellij.lang.annotations.Language

/**
* Base class for testing rules without fixing code.
Expand All @@ -23,7 +24,7 @@ open class LintTestBase(private val ruleSupplier: (rulesConfigList: List<RulesCo
* @param fileName optional override for file name
*/
@OptIn(FeatureInAlphaState::class)
fun lintMethod(code: String,
fun lintMethod(@Language("kotlin") code: String,
vararg lintErrors: LintError,
rulesConfigList: List<RulesConfig>? = null,
fileName: String? = null
Expand Down
2 changes: 1 addition & 1 deletion examples/gradle-groovy-dsl/diktat-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
# Is newline at the end of a file needed
newlineAtEnd: true
# If true: in parameter list when parameters are split by newline they are indented with two indentations instead of one
extendedIndentOfParameters: true
extendedIndentOfParameters: false
# If true: if first parameter in parameter list is on the same line as opening parenthesis, then other parameters can be aligned with it
alignedParameters: true
# If true: if expression is split by newline after operator like +/-/`*`, then the next line is indented with two indentations instead of one
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
enabled: true
configuration:
newlineAtEnd: true
extendedIndentOfParameters: true
extendedIndentOfParameters: false
alignedParameters: true
extendedIndentAfterOperators: true
indentationSize: 4
Expand Down
2 changes: 1 addition & 1 deletion examples/gradle-kotlin-dsl/diktat-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
# Is newline at the end of a file needed
newlineAtEnd: true
# If true: in parameter list when parameters are split by newline they are indented with two indentations instead of one
extendedIndentOfParameters: true
extendedIndentOfParameters: false
# If true: if first parameter in parameter list is on the same line as opening parenthesis, then other parameters can be aligned with it
alignedParameters: true
# If true: if expression is split by newline after operator like +/-/`*`, then the next line is indented with two indentations instead of one
Expand Down
2 changes: 1 addition & 1 deletion examples/maven/diktat-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
# Is newline at the end of a file needed
newlineAtEnd: true
# If true: in parameter list when parameters are split by newline they are indented with two indentations instead of one
extendedIndentOfParameters: true
extendedIndentOfParameters: false
# If true: if first parameter in parameter list is on the same line as opening parenthesis, then other parameters can be aligned with it
alignedParameters: true
# If true: if expression is split by newline after operator like +/-/`*`, then the next line is indented with two indentations instead of one
Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
</licenses>

<scm>
<connection>scm:git:git://github.com/cqfn/diktat.git</connection>
<developerConnection>scm:git:ssh://github.com:cqfn/diktat.git</developerConnection>
<url>http://github.com/cqfn/diktat/tree/master</url>
<connection>scm:git:git://github.com/saveourtool/diktat.git</connection>
<developerConnection>scm:git:ssh://github.com:saveourtool/diktat.git</developerConnection>
<url>http://github.com/saveourtool/diktat/tree/master</url>
</scm>

<developers>
Expand Down
2 changes: 1 addition & 1 deletion wp/sections/diKTat.tex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
\subsection{What is diKTat?}
DiKTat \footnote{\url{https://github.com/cqfn/diKTat}} - is a formal strict code-style for Kotlin language and a linter with a set of rules that implement this code-style. Basically, it is a collection of Kotlin code style rules implemented as AST visitors on top of KTlint framework \footnote{\url{https://github.com/pinterest/ktlint}}. Diktat detects and automatically fixes code style errors and code smells based on the configuration of rules. DiKTat is a highly configurable framework, that can be extended further by adding custom rules. It can be run as command line application or with maven or gradle plugins. In this paper, we will explain how diKTat works, describe its advantages and disadvantages and compare it with other static analyzers for Kotlin. The main idea is to use diktat in your CI/CD pipeline.
DiKTat \footnote{\url{https://github.com/saveourtool/diKTat}} - is a formal strict code-style for Kotlin language and a linter with a set of rules that implement this code-style. Basically, it is a collection of Kotlin code style rules implemented as AST visitors on top of KTlint framework \footnote{\url{https://github.com/pinterest/ktlint}}. Diktat detects and automatically fixes code style errors and code smells based on the configuration of rules. DiKTat is a highly configurable framework, that can be extended further by adding custom rules. It can be run as command line application or with maven or gradle plugins. In this paper, we will explain how diKTat works, describe its advantages and disadvantages and compare it with other static analyzers for Kotlin. The main idea is to use diktat in your CI/CD pipeline.

\subsection{Why diKTat?}
DiKTat permits formal flexible description or Rules and Inspections expressed by means of yml file. We looked at similar existing projects and realized that their functionality does not give us a chance to implement our own configurable code style. Most of rules which we wanted to implement were missing in other analyzers. Mostly all of those analyzers had hardcoded logic and prohibited configuration. That’s why we decided that we need to create convenient, user friendly and easily configured tool for developers.
Expand Down
2 changes: 1 addition & 1 deletion wp/sections/work.tex
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ \subsection{DiKTat}

Another feature of ktlint is that at it's startup you can provide a JAR file with additional ruleset(s), that will be discovered by the \texttt{ServiceLoader} and then all AST nodes will be passed to these rules. DiKTat uses this approach.

The only modification Diktat makes to the framework is that it adds a mechanism to disable Inspection from the code using annotations or configuration file. The set of all rules is described in the \textsl{DiktatRuleSetProvider}\footnote{\url{https://github.com/cqfn/diKTat/blob/v0.1.3/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/DiktatRuleSetProvider.kt}} class. This class overrides the \textsl{get()} method of the \textsl{RuleSetProvider}\footnote{\url{https://github.com/pinterest/ktlint/blob/master/ktlint-core/src/main/kotlin/com/pinterest/ktlint/core/RuleSetProvider.kt}} interface, which returns a set of rules to be "traversed". But before returning this set Diktat is reading the configuration file where the user has independently configured all the Inspections. If there is no configuration file, then a warning will be displayed and Inspections will use the default configuration file.
The only modification Diktat makes to the framework is that it adds a mechanism to disable Inspection from the code using annotations or configuration file. The set of all rules is described in the \textsl{DiktatRuleSetProvider}\footnote{\url{https://github.com/saveourtool/diKTat/blob/v0.1.3/diktat-rules/src/main/kotlin/org/cqfn/diktat/ruleset/rules/DiktatRuleSetProvider.kt}} class. This class overrides the \textsl{get()} method of the \textsl{RuleSetProvider}\footnote{\url{https://github.com/pinterest/ktlint/blob/master/ktlint-core/src/main/kotlin/com/pinterest/ktlint/core/RuleSetProvider.kt}} interface, which returns a set of rules to be "traversed". But before returning this set Diktat is reading the configuration file where the user has independently configured all the Inspections. If there is no configuration file, then a warning will be displayed and Inspections will use the default configuration file.
Each rule must implement the \textsl{visit} method of the abstract Rule class, which describes the logic of the rule. By the way it is a special case of a famous pattern Visitor \cite{ref:gang}. Implementation example of the simple Rule that contains one Inspections can be found below.

\begin{lstlisting}[caption={Example of the Rule.}, label={lst:example1}, language=Kotlin]
Expand Down