Puneeth Reddy V
Puneeth Reddy V

Reputation: 1568

How to specific Scala style rules for a specific file/directory?

I have some cucumber stepDef steps which are more than more than 120 characters in length, I want to exclude all stepDef files from Scala style warning.

Is there a way to to exclude a specific files/directories, using xml tag only for FileLineLengthChecker condition?

Upvotes: 1

Views: 1448

Answers (2)

Fei YuanXing
Fei YuanXing

Reputation: 11

scalastyle must Paired use

// scalastyle:off line.size.limit

_FUNC_(str, regexp) - Searches a string for a regular expression and returns an integer that indicates the beginning position of the matched substring. Positions are 1-based, not 0-based. If no match is found, returns 0.

// scalastyle:on line.size.limit

Upvotes: 0

Mario Galic
Mario Galic

Reputation: 48400

Wrapping the entire file in the following comment filter in effect excludes the file from FileLineLengthChecker rule:

// scalastyle:off line.size.limit
val foobar = 134
// scalastyle:on line.size.limit

line.size.limit is the ID of FileLineLengthChecker rule.

Multiple rules can be switched off simultaneously like so

// scalastyle:off line.size.limit
// scalastyle:off line.contains.tab
// ...

Upvotes: 2

Related Questions