Commit Graph

54 Commits

Author SHA1 Message Date
JP Simard b83e0991b9 Remove all file headers
The MIT license doesn't require that all files be prepended with this
licensing or copyright information. Realm confirmed that they're ok with this
change. This will enable some companies to contribute to SwiftLint and the
date & authorship information will remain accessible via git source control.
2018-05-04 13:42:02 -07:00
Norio Nomura 2a0ac455bc 'flatMap' is deprecated: renamed to 'compactMap(_:)' 2018-04-08 13:28:09 +09:00
Marcelo Fabri 0be8c855d2 Move functions to properties and Sets instead of Arrays 2017-10-04 14:34:00 -07:00
JP Simard 7acacf6bdb update dependencies, mostly for SourceKitten 0.18 2017-07-12 10:11:27 -07:00
Marcelo Fabri e86763739f Move kind to RuleDescription 2017-07-02 15:50:16 +02:00
Marcelo Fabri 5012211d3d Add RuleKind 2017-07-02 15:50:16 +02:00
JP Simard acc7808b04 use kinds(inByteRange:) in more places
CommaRule, ExplicitTopLevelACLRule, ForceUnwrappingRule, ForWhereRule
2017-05-25 11:18:00 -07:00
JP Simard 7522635ad8 update SwiftLintFramework/Rules to follow Swift 3 API Design Guidelines 2017-01-09 19:37:53 -08:00
JP Simard 9e7cdc3282 update SwiftLintFramework/Protocols to follow Swift 3 API Design Guidelines 2017-01-09 19:19:25 -08:00
JP Simard a291bb594a update SwiftLintFramework/Extensions to follow Swift 3 API Design Guidelines 2017-01-09 17:53:07 -08:00
Marcelo Fabri 50535e7e5c Refactor regex functions to accept options
Fixes #1127
2017-01-06 21:04:15 -02:00
Marcelo Fabri 3f6ca7611a Fix violations 2016-12-19 20:08:17 -02:00
Marcelo Fabri 9e4d464e45 Add violation markers in rules 2016-12-18 01:07:51 -02:00
JP Simard a5a1ed7a70 don't omit options param in NSRegularExpression calls
since these aren't optional on Linux, so this will help align
cross-platform code.
2016-12-11 14:04:49 -08:00
JP Simard 0faf567931 use bridge() rather than explict or implicit casts
this is a step in aligning the code to compile on both Darwin and
Linux
2016-12-11 13:47:44 -08:00
JP Simard 19fad01b29 make all enum members lowercase to comply with Swift 3 API Guidelines 2016-12-01 22:16:21 -08:00
Norio Nomura 84ca11b6aa Merge commit 'b22d1a93c93537acde79a2496031012489fe270d' into swift3.0
* commit 'b22d1a93c93537acde79a2496031012489fe270d':
  Updating CHANGELOG entry
  Updates existing code to respect TrailingCommaRule
  Add configuration to enforce/forbid trailing comma
  Fixing rebase
  Addded TrailingCommaRule
2016-11-30 19:38:31 +09:00
Norio Nomura b94f2cc292 Merge commit '0dc882b0801c03fcc52d7c4eed72fa5f68f32370' into swift3.0
* commit '0dc882b0801c03fcc52d7c4eed72fa5f68f32370':
  Improving comma rule to support expressions that begin with the comma (fixes a gap when there are consecutive comma violations)
  Improving comma rule to support expressions that begin with the comma (fixes a gap when there are consecutive comma violations)

# Conflicts:
#	Source/SwiftLintFramework/Rules/CommaRule.swift
2016-11-30 19:14:41 +09:00
Marcelo Fabri d8fd865491 Updates existing code to respect TrailingCommaRule 2016-11-25 23:52:07 -02:00
Savio Mendes de Figueiredo ce502db5c6 Improving comma rule to support expressions that begin with the comma (fixes a gap when there are consecutive comma violations)
Fixing swiflint warnings

Improving comma rule to support expressions that begin with the comma (fixes a gap when there are consecutive comma violations)
For example, if the expression is 'let a = [1,2,3]', the previous comma rule regexp would consume '1,2' and the remaining ',3' would not be consumed by the regexp because it does not support something that begins with a comma.

Updating changelog.md

Improving comma rule to support expressions that begin with the comma (fixes a gap when there are consecutive comma violations)
2016-11-11 20:41:37 -08:00
Norio Nomura 40828dff03 Merge branch 'master' into swift3.0
* master: (41 commits)
  Fix formatting in CHANGELOG.md
  release 0.13.0
  Update CHANGELOG.md
  Fix check for trailing whitespace to return early
  Fix checks for some inline comments
  Replace check for comments to use SyntaxKind
  Add configuration for trailing_whitespace to ignore comments
  Unwanted space removed
  - Lint issues fixed
  Updated HTML Reporter
  PR feedback
  Add check on autocorrect for disabled range
  Use `utf8.count` instead of `utf16.count` to byte range
  Re-write `ExplicitInitRule` to `ASTRule`
  added ExplicitInitRule
  Updated CHANGELOG
  HTML Reporter added
  HTML Reporter added
  Adds information about SwiftLint plugin for AppCode into README.md
  added reasons why a new rule should be opt in
  ...

# Conflicts:
#	Source/SwiftLintFramework/Extensions/File+SwiftLint.swift
#	Source/SwiftLintFramework/Extensions/Structure+SwiftLint.swift
#	Source/SwiftLintFramework/Rules/ColonRule.swift
#	Source/SwiftLintFramework/Rules/CommaRule.swift
#	Source/SwiftLintFramework/Rules/LegacyCGGeometryFunctionsRule.swift
#	Source/SwiftLintFramework/Rules/LegacyConstantRule.swift
#	Source/SwiftLintFramework/Rules/LegacyConstructorRule.swift
#	Source/SwiftLintFramework/Rules/LegacyNSGeometryFunctionsRule.swift
#	Source/SwiftLintFramework/Rules/LineLengthRule.swift
#	Source/SwiftLintFramework/Rules/OperatorFunctionWhitespaceRule.swift
#	Source/SwiftLintFramework/Rules/ReturnArrowWhitespaceRule.swift
#	Source/SwiftLintFramework/Rules/RuleConfigurations/StatementPositionConfiguration.swift
#	Source/SwiftLintFramework/Rules/StatementPositionRule.swift
#	Source/SwiftLintFramework/Rules/TrailingWhitespaceRule.swift
#	Tests/SwiftLintFramework/RuleConfigurationTests.swift
2016-11-04 21:40:56 +09:00
Norio Nomura ec3f9d0c94 Fix line_length style violations, unused warnings 2016-10-13 22:40:45 +09:00
Norio Nomura 8bf15f1dba Migrate to Swift 3.0 2016-10-09 01:09:50 +09:00
J Cheyo Jimenez 48a085cfc1 Added disable rule test to autocorrect 2016-08-30 15:41:17 -07:00
Norio Nomura 07f25eb00d Fix minor wording
[ci skip]
2016-06-08 15:24:36 +09:00
Norio Nomura fcd30c5b72 Skip checking existence of trailing comment in CommaRule if already violating
Fix #683
2016-06-08 15:10:10 +09:00
Norio Nomura 82fef3532a Add failing test from #683 to CommaRule 2016-06-08 14:25:02 +09:00
Norio Nomura 704e7bde1d Add SyntaxMap.tokensIn(_:)
That returns array of SyntaxTokens intersecting with byte range.
2016-02-19 17:30:54 +09:00
Norio Nomura 32b98baf4c Exclude new line characters from trailing whitespace 2016-02-17 11:15:41 +09:00
Norio Nomura ecbfb46398 Add failing non trigger example
```swift
func abc(
  a: String,
  bcd: String
) {
}
```
2016-02-17 11:15:41 +09:00
Norio Nomura 6f17c93bd6 Add check trailing comment 2016-02-17 11:15:41 +09:00
Norio Nomura 78255e098b Add failing non trigger examples
```swift
func abc(
  a: String,  // comment
  bcd: String // comment
) {
}
```
2016-02-17 11:15:41 +09:00
Norio Nomura 8c35e1d3db Share regular expression between validateFile(_:) and correctFile(_:) in CommaRule 2016-02-17 11:15:41 +09:00
Norio Nomura 193d4ef446 Simplify the regular expression in CommaRule.validateFile(_:) 2016-02-17 11:11:47 +09:00
Norio Nomura 1b2ba7ac88 Rewrite CommaRule.correctFile(_:)
Now corrections happen only on violations.
Because `assertCorrection(_:expected:)` expects one correction for each `corrections`,
and the rule added by 93e8e12 causes two corrections on previous logic.

Fix #466
2016-02-17 11:11:47 +09:00
Norio Nomura 8539953c09 Add failing correction example from #466 to CommaRule
https://github.com/realm/SwiftLint/issues/466#issuecomment-184474925
2016-02-17 11:11:47 +09:00
JP Simard 144495306b rename rule configurations to expand "Config" to "Configuration" 2016-02-12 10:53:36 -08:00
JP Simard 6befe7e5a4 expand many instances of "config" to "configuration" 2016-02-12 10:53:36 -08:00
JP Simard 3f4b993847 rename ConfigProviderRule to ConfigurationProviderRule 2016-02-12 10:53:36 -08:00
Scott Hoyt f722bcf360 All Rules (with the exception of MissingDocs) now provide some severity configuration. 2016-01-23 17:42:13 -08:00
JP Simard 4c52163a70 add rule to encourage checking isEmpty over comparing count to zero 2016-01-13 15:41:25 -08:00
Scott Hoyt 9b6f3070a3 Wrote ConfigurableRule, made ParameterizedRule's conform, moved configuration into rules themselves. 2016-01-11 11:21:49 -08:00
Eric Bailey b33c5d870f Update CommaRule.swift
Reword the description a bit, based on @jpsim's suggestion.
2016-01-09 01:42:47 -06:00
Eric Bailey a7b65b2570 Fix typo in CommaRule.swift
The description implied the opposite of the rule.
2016-01-09 00:02:25 -06:00
Raphael Randschau e4f27dab63 Add autocorrect for CommaRule 2016-01-08 21:49:32 +01:00
JP Simard 85d8c68978 test violation locations 2015-12-27 13:33:42 -05:00
JP Simard 8d529f1804 Fix multibyte handling in many rules 2015-12-24 20:59:15 -05:00
JP Simard 96a4e6cc2f remove init() from Rule. 2015-11-29 21:43:53 -08:00
JP Simard 9be89a686e fix inappropriate uses of flatMap where we should be using map 2015-11-27 17:32:21 -08:00
JP Simard 989127cbe0 [StyleViolation] use RuleDescription's description when reason is nil
Many cases just used a static string that was nearly identical to the rule
description as the `reason` parameter when initializing a StyleViolation.
2015-11-17 10:25:57 -08:00