createLinter creates a new linter instance with configured rules
()
| 397 | |
| 398 | // createLinter creates a new linter instance with configured rules |
| 399 | func createLinter() *linter.Linter { |
| 400 | return linter.New( |
| 401 | // Whitespace rules (L001, L002, L003, L004, L005, L010) |
| 402 | whitespace.NewTrailingWhitespaceRule(), // L001 |
| 403 | whitespace.NewMixedIndentationRule(), // L002 |
| 404 | whitespace.NewConsecutiveBlankLinesRule(1), // L003 |
| 405 | whitespace.NewIndentationDepthRule(4, 4), // L004 |
| 406 | whitespace.NewLongLinesRule(lintMaxLength), // L005 |
| 407 | whitespace.NewRedundantWhitespaceRule(), // L010 |
| 408 | |
| 409 | // Style rules (L006, L008, L009) |
| 410 | style.NewColumnAlignmentRule(), // L006 |
| 411 | style.NewCommaPlacementRule(style.CommaTrailing), // L008 |
| 412 | style.NewAliasingConsistencyRule(true), // L009 |
| 413 | |
| 414 | // Keyword rules (L007) |
| 415 | keywords.NewKeywordCaseRule(keywords.CaseUpper), // L007 |
| 416 | ) |
| 417 | } |
| 418 | |
| 419 | func init() { |
| 420 | rootCmd.AddCommand(lintCmd) |