Skip to content

Commit

Permalink
Disable no wildcard rule (#435)
Browse files Browse the repository at this point in the history
Bandaid for pinterest/ktlint#48

Also adding list of disabled rules to README for visibility.
  • Loading branch information
shashachu authored May 22, 2019
1 parent 2a829db commit df55f84
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 18 deletions.
41 changes: 24 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,23 @@ It's also [easy to create your own](#creating-a-reporter).
## Standard rules

- 4 spaces for indentation
(unless a different `indent_size` value is set in .editorconfig (see [EditorConfig](#editorconfig) section for more));
- No semicolons (unless used to separate multiple statements on the same line);
- No wildcard / unused `import`s;
- No consecutive blank lines;
- No blank lines before `}`;
- No trailing whitespaces;
- No `Unit` returns (`fun fn {}` instead of `fun fn: Unit {}`);
- No empty (`{}`) class bodies;
- No spaces around range (`..`) operator;
- No newline before (binary) `+` & `-`, `*`, `/`, `%`, `&&`, `||`;
- When wrapping chained calls `.`, `?.` and `?:` should be placed on the next line;
- When a line is broken at an assignment (`=`) operator the break comes after the symbol;
- When class/function signature doesn't fit on a single line, each parameter must be on a separate line;
- Consistent string templates (`$v` instead of `${v}`, `${p.v}` instead of `${p.v.toString()}`);
- Consistent order of modifiers;
- Consistent spacing after keywords, commas; around colons, curly braces, parens, infix operators, comments, etc;
- Newline at the end of each file (not enabled by default, but recommended)
(unless a different `indent_size` value is set in .editorconfig (see [EditorConfig](#editorconfig) section for more))
- No semicolons (unless used to separate multiple statements on the same line)
- No unused `import`s
- No consecutive blank lines
- No blank lines before `}`
- No trailing whitespaces
- No `Unit` returns (`fun fn {}` instead of `fun fn: Unit {}`)
- No empty (`{}`) class bodies
- No spaces around range (`..`) operator
- No newline before (binary) `+` & `-`, `*`, `/`, `%`, `&&`, `||`
- When wrapping chained calls `.`, `?.` and `?:` should be placed on the next line
- When a line is broken at an assignment (`=`) operator the break comes after the symbol
- When class/function signature doesn't fit on a single line, each parameter must be on a separate line
- Consistent string templates (`$v` instead of `${v}`, `${p.v}` instead of `${p.v.toString()}`)
- Consistent order of modifiers
- Consistent spacing after keywords, commas; around colons, curly braces, parens, infix operators, comments, etc
- Newline at the end of each file (not enabled by default, but recommended)
(set `insert_final_newline=true` in .editorconfig to enable (see [EditorConfig](#editorconfig) section for more)).

## Experimental rules
Expand All @@ -56,6 +56,13 @@ by passing the `--experimental` flag to `ktlint`.
- Indentation formatting
- Import ordering

## Disabled rules
- No wildcard `import`s
- Annotation formatting
- No underscores in package names
- Braces required for if/else statements
- Multi-line lambdas must name `it` param

## EditorConfig

ktlint recognizes the following [.editorconfig](http://editorconfig.org/) properties (provided they are specified under `[*.{kt,kts}]`):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,11 @@ class StandardRuleSetProvider : RuleSetProvider {
NoTrailingSpacesRule(),
NoUnitReturnRule(),
NoUnusedImportsRule(),
NoWildcardImportsRule(),
// Disabling because it is now allowed by the Jetbrains styleguide, although it is still disallowed by
// the Android styleguide.
// Re-enable when there is a way to globally disable rules
// See discussion here: https://github.com/pinterest/ktlint/issues/48
// NoWildcardImportsRule(),
ParameterListWrappingRule(),
SpacingAroundColonRule(),
SpacingAroundCommaRule(),
Expand Down

0 comments on commit df55f84

Please sign in to comment.