Skip to content

Commit

Permalink
Merge branch 'release/0.9.1' into versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeehut committed Apr 25, 2022
2 parents 789e732 + 1073b8c commit 80c757d
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 9 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ If needed, pluralize to `Tasks`, `PRs` or `Authors` and list multiple entries se
### Security
- None.

## [0.9.1] - 2022-04-25
### Changed
- Default violation level was changed from `error` to `warning`.
Author: [Cihat Gündüz](https://github.com/Jeehut) | Issue: [#47](https://github.com/FlineDev/AnyLint/issues/47)

## [0.9.0] - 2022-04-24
### Added
- Added new option `violationLocation` parameter for `checkFileContents` for specifying position of violation marker using `.init(range:bound:)`, where `range` can be one of `.fullMatch` or `.captureGroup(index:)` and bound one of `.lower` or `.upper`.
Expand Down
2 changes: 1 addition & 1 deletion Formula/anylint.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Anylint < Formula
desc "Lint anything by combining the power of Swift & regular expressions"
homepage "https://github.com/FlineDev/AnyLint"
url "https://github.com/FlineDev/AnyLint.git", :tag => "0.8.5", :revision => "1078228fb2251d9efa369768530638790587d4eb"
url "https://github.com/FlineDev/AnyLint.git", :tag => "0.9.0", :revision => "77e24fdedb70413dd8f750799dedc4b309b7c8eb"
head "https://github.com/FlineDev/AnyLint.git"

depends_on :xcode => ["12.5", :build]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
alt="Coverage"/>
</a>
<a href="https://github.com/FlineDev/AnyLint/releases">
<img src="https://img.shields.io/badge/Version-0.9.0-blue.svg"
alt="Version: 0.9.0">
<img src="https://img.shields.io/badge/Version-0.9.1-blue.svg"
alt="Version: 0.9.1">
</a>
<a href="https://github.com/FlineDev/AnyLint/blob/main/LICENSE">
<img src="https://img.shields.io/badge/License-MIT-lightgrey.svg"
Expand Down
2 changes: 1 addition & 1 deletion Sources/AnyLint/CheckInfo.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public struct CheckInfo {
public let severity: Severity

/// Initializes a new info object for the lint check.
public init(id: String, hint: String, severity: Severity = .error) {
public init(id: String, hint: String, severity: Severity = .warning) {
self.id = id
self.hint = hint
self.severity = severity
Expand Down
15 changes: 11 additions & 4 deletions Sources/AnyLint/Checkers/FileContentsChecker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,23 @@ extension FileContentsChecker: Checker {
locationInfo = fileContents.locationInfo(of: match.range.lowerBound)

case .upper:
locationInfo = fileContents.locationInfo(of: match.range.lowerBound)
locationInfo = fileContents.locationInfo(of: match.range.upperBound)
}

case .captureGroup(let index):
let capture = match.captures[index]!
let captureRange = NSRange(match.string.range(of: capture)!, in: match.string)

switch self.violationLocation.bound {
case .lower:
locationInfo = fileContents.locationInfo(of: match.range.lowerBound)
locationInfo = fileContents.locationInfo(
of: fileContents.index(match.range.lowerBound, offsetBy: captureRange.location)
)

case .upper:
locationInfo = fileContents.locationInfo(of: match.range.lowerBound)
locationInfo = fileContents.locationInfo(
of: fileContents.index(match.range.lowerBound, offsetBy: captureRange.location + captureRange.length)
)
}
}

Expand Down Expand Up @@ -117,7 +124,7 @@ extension FileContentsChecker: Checker {
let violationsOnRechecks = try FileContentsChecker(
checkInfo: checkInfo,
regex: regex,
violationLocation: self.violationLocation
violationLocation: self.violationLocation,
filePathsToCheck: filePathsToReCheck,
autoCorrectReplacement: autoCorrectReplacement,
repeatIfAutoCorrected: repeatIfAutoCorrected
Expand Down
2 changes: 1 addition & 1 deletion Sources/Utility/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public var log = Logger(outputType: .console)
/// Constants to reference across the project.
public enum Constants {
/// The current tool version string. Conforms to SemVer 2.0.
public static let currentVersion: String = "0.9.0"
public static let currentVersion: String = "0.9.1"

/// The name of this tool.
public static let toolName: String = "AnyLint"
Expand Down

0 comments on commit 80c757d

Please sign in to comment.