Skip to content

Commit 84a8886

Browse files
authored
Merge pull request #191 from modelix/feature/MODELIX-461-Enable-ktlint-in-modelix-core
MODELIX-461: enable ktlint in modelix core
2 parents ee46c36 + 81dd8f8 commit 84a8886

File tree

290 files changed

+2063
-1469
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

290 files changed

+2063
-1469
lines changed

.github/workflows/linting.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Code linting
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
pre-commit:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
- uses: actions/setup-python@v4
12+
- uses: pre-commit/[email protected]

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ kotlin_gen
99
/version.txt
1010
/node_modules
1111
**/.ideaconfig
12-
**/.mpsconfig
12+
**/.mpsconfig

.idea/codeStyles/Project.xml

Lines changed: 19 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/codeStyles/codeStyleConfig.xml

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/copyright/Modelix.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/copyright/profiles_settings.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.pre-commit-config.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,31 @@ default_install_hook_types:
33
- pre-commit
44
- commit-msg
55
repos:
6+
- repo: https://github.com/pre-commit/pre-commit-hooks
7+
rev: v4.4.0
8+
hooks:
9+
- id: trailing-whitespace
10+
- id: end-of-file-fixer
11+
- id: check-toml
12+
- id: check-yaml
13+
- id: check-added-large-files
14+
- id: check-merge-conflict
15+
- id: check-symlinks
16+
- id: fix-byte-order-marker
17+
- id: mixed-line-ending
18+
- id: trailing-whitespace
619
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
720
rev: v9.4.0
821
hooks:
922
- id: commitlint
1023
stages: [commit-msg]
1124
additional_dependencies: ["@commitlint/config-angular"]
1225
args: ["--config", "./commitlint.config.js"]
26+
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
27+
rev: v2.10.0
28+
hooks:
29+
- id: pretty-format-kotlin
30+
args:
31+
# IMPORTANT: keep in sync with the version configured in build.gradle.kts
32+
- --ktlint-version=0.50.0
33+
- --autofix

authorization/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,4 @@ publishing {
3434
from(components["kotlin"])
3535
}
3636
}
37-
}
37+
}

authorization/src/main/kotlin/org/modelix/authorization/AccessTokenPrincipal.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
package org.modelix.authorization
1515

1616
import com.auth0.jwt.interfaces.DecodedJWT
17-
import io.ktor.server.auth.*
17+
import io.ktor.server.auth.Principal
1818

1919
class AccessTokenPrincipal(val jwt: DecodedJWT) : Principal {
2020
fun getUserName(): String? = jwt.getClaim("email")?.asString()
2121
?: jwt.getClaim("preferred_username")?.asString()
22-
}
22+
}

authorization/src/main/kotlin/org/modelix/authorization/EPermissionType.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ package org.modelix.authorization
1515

1616
enum class EPermissionType(vararg val includedTypes: EPermissionType) {
1717
READ,
18-
WRITE(READ);
18+
WRITE(READ),
19+
;
1920

2021
fun includes(type: EPermissionType): Boolean = type == this || includedTypes.any { it.includes(type) }
21-
}
22+
}

0 commit comments

Comments
 (0)