Skip to content

Commit

Permalink
Merge branch 'release/0.11.0' into versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeehut committed Apr 9, 2023
2 parents 84ee29f + b69f38e commit 3c1bdfc
Show file tree
Hide file tree
Showing 56 changed files with 2,932 additions and 2,973 deletions.
105 changes: 16 additions & 89 deletions .github/workflows/main.yml
Expand Up @@ -2,109 +2,36 @@ name: CI

on:
push:
branches: [main, versions]
pull_request:
branches: [main]

jobs:
cancel-previous-runs:
runs-on: ubuntu-latest

steps:
- name: Cancel previous runs of this workflow on same branch
uses: rokroskar/workflow-run-cleanup-action@v0.2.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

anylint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Export latest tool versions
run: |
latest_version() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'
}
echo "ANYLINT_LATEST_VERSION=$( latest_version Flinesoft/AnyLint )" >> $GITHUB_ENV
echo "SWIFT_SH_LATEST_VERSION=$( latest_version mxcl/swift-sh )" >> $GITHUB_ENV
- name: AnyLint Cache
uses: actions/cache@v1
id: anylint-cache
with:
path: anylint-cache
key: ${{ runner.os }}-v1-anylint-${{ env.ANYLINT_LATEST_VERSION }}-swift-sh-${{ env.SWIFT_SH_LATEST_VERSION }}

- name: Copy from cache
if: steps.anylint-cache.outputs.cache-hit
run: |
sudo cp -f anylint-cache/anylint /usr/local/bin/anylint
sudo cp -f anylint-cache/swift-sh /usr/local/bin/swift-sh
- name: Install AnyLint
if: steps.anylint-cache.outputs.cache-hit != 'true'
run: |
git clone https://github.com/Flinesoft/AnyLint.git
cd AnyLint
swift build -c release
sudo cp -f .build/release/anylint /usr/local/bin/anylint
- name: Install swift-sh
if: steps.anylint-cache.outputs.cache-hit != 'true'
run: |
git clone https://github.com/mxcl/swift-sh.git
cd swift-sh
swift build -c release
sudo cp -f .build/release/swift-sh /usr/local/bin/swift-sh
- name: Copy to cache
if: steps.anylint-cache.outputs.cache-hit != 'true'
run: |
mkdir -p anylint-cache
cp -f /usr/local/bin/anylint anylint-cache/anylint
cp -f /usr/local/bin/swift-sh anylint-cache/swift-sh
pull_request:
branches: [main]

- name: Cleanup checkouts
run: rm -rf AnyLint && rm -rf swift-sh
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true

- name: Run AnyLint
run: anylint

jobs:
swiftlint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Checkout Source
uses: actions/checkout@v3

- name: Run SwiftLint
uses: norio-nomura/action-swiftlint@3.1.0
uses: norio-nomura/action-swiftlint@3.2.1
with:
args: --strict

test-linux:
runs-on: ubuntu-latest
ci:
runs-on: macos-latest
needs: swiftlint

steps:
- uses: actions/checkout@v2

- name: Checkout Source
uses: actions/checkout@v3

- name: Run tests
run: swift test -v

test-macos:
runs-on: macos-11

steps:
- uses: actions/checkout@v2

- name: Run tests
run: swift test -v --enable-code-coverage

- name: Report Code Coverage
run: |
xcrun llvm-cov export -format="lcov" .build/debug/${PACKAGE_NAME}PackageTests.xctest/Contents/MacOS/${PACKAGE_NAME}PackageTests -instr-profile .build/debug/codecov/default.profdata > coverage.lcov
bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r coverage.lcov
env:
PACKAGE_NAME: AnyLint
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
run: swift test
4 changes: 4 additions & 0 deletions .spi.yml
@@ -0,0 +1,4 @@
version: 1
builder:
configs:
- documentation_targets: [AnyLint]
7 changes: 6 additions & 1 deletion .swiftlint.yml
Expand Up @@ -85,8 +85,10 @@ excluded:
- Tests/LinuxMain.swift

disabled_rules:
- todo
- blanket_disable_command
- cyclomatic_complexity
- todo


# Rule Configurations
conditional_returns_on_newline:
Expand All @@ -107,6 +109,9 @@ identifier_name:
- db
- to

indentation_width:
indentation_width: 3

line_length:
warning: 160
ignores_comments: true
Expand Down
19 changes: 17 additions & 2 deletions CHANGELOG.md
Expand Up @@ -31,6 +31,21 @@ If needed, pluralize to `Tasks`, `PRs` or `Authors` and list multiple entries se
### Security
- None.

## [0.11.0] - 2023-04-09
### Added
- Added a new `--unvalidated` (`-u`) option for running all checks without running the validations provided, such as testing for `matchingExamples` and `nonMatchingExamples`. Use with cuation.
### Changed
- Some internal code clean-up.
- Upgrade to Swift 5.7 manifest syntax.
### Deprecated
- None.
### Removed
- None.
### Fixed
- The `--measure` option also measured validations & files search which distorted the measure time for the first check with the same files search. Now, it only measures the actual matching time of the Regex for better evaluation.
### Security
- None.

## [0.10.1] - 2022-05-27
### Changed
- Improved output color & formatting of new `--measure` option for printing execution time per check.
Expand Down Expand Up @@ -60,11 +75,11 @@ If needed, pluralize to `Tasks`, `PRs` or `Authors` and list multiple entries se
## [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`.

## [0.8.5] - 2022-04-24
### Fixed
- Fixed an issue where first violation can't be shown in Xcode due to 'swift-driver version: 1.45.2' printed on same line.

## [0.8.4] - 2022-04-01
### Fixed
- Fixed an issue with pointing to the wrong Swift-SH path on Apple Silicon Macs. Should also fix the path on Linux.
Expand Down
4 changes: 2 additions & 2 deletions Formula/anylint.rb
@@ -1,10 +1,10 @@
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.10.0", :revision => "5a9c6d2289e1fc4e4f453c04d8a1ec891ea0797d"
url "https://github.com/FlineDev/AnyLint.git", :tag => "0.10.1", :revision => "84ee29f12ae7297e917c9a3339dfb25e5dca6dd5"
head "https://github.com/FlineDev/AnyLint.git"

depends_on :xcode => ["12.5", :build]
depends_on :xcode => ["14.0", :build]
depends_on "swift-sh"

def install
Expand Down
70 changes: 33 additions & 37 deletions Package.swift
@@ -1,41 +1,37 @@
// swift-tools-version:5.4
// swift-tools-version:5.7
import PackageDescription

let package = Package(
name: "AnyLint",
platforms: [.macOS(.v10_12)],
products: [
.library(name: "AnyLint", targets: ["AnyLint", "Utility"]),
.executable(name: "anylint", targets: ["AnyLintCLI"]),
],
dependencies: [
.package(url: "https://github.com/onevcat/Rainbow.git", from: "3.1.5"),
.package(url: "https://github.com/jakeheis/SwiftCLI.git", from: "6.0.1"),
],
targets: [
.executableTarget(
name: "AnyLintCLI",
dependencies: ["Rainbow", "SwiftCLI", "Utility"]
),
.target(
name: "AnyLint",
dependencies: ["Utility"]
),
.target(
name: "Utility",
dependencies: ["Rainbow"]
),
.testTarget(
name: "AnyLintTests",
dependencies: ["AnyLint"]
),
.testTarget(
name: "AnyLintCLITests",
dependencies: ["AnyLintCLI"]
),
.testTarget(
name: "UtilityTests",
dependencies: ["Utility"]
)
]
name: "AnyLint",
platforms: [.macOS(.v10_13)],
products: [
.library(name: "AnyLint", targets: ["AnyLint"]),
.executable(name: "anylint", targets: ["AnyLintCLI"]),
],
dependencies: [
.package(url: "https://github.com/onevcat/Rainbow.git", from: "3.1.5"),
.package(url: "https://github.com/jakeheis/SwiftCLI.git", from: "6.0.1"),
],
targets: [
.target(
name: "AnyLint",
dependencies: ["Utility"]
),
.testTarget(
name: "AnyLintTests",
dependencies: ["AnyLint"]
),
.executableTarget(
name: "AnyLintCLI",
dependencies: ["Rainbow", "SwiftCLI", "Utility"]
),
.target(
name: "Utility",
dependencies: ["Rainbow"]
),
.testTarget(
name: "UtilityTests",
dependencies: ["Utility"]
),
]
)
5 changes: 3 additions & 2 deletions README.md
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.10.1-blue.svg"
alt="Version: 0.10.1">
<img src="https://img.shields.io/badge/Version-0.11.0-blue.svg"
alt="Version: 0.11.0">
</a>
<a href="https://github.com/FlineDev/AnyLint/blob/main/LICENSE">
<img src="https://img.shields.io/badge/License-MIT-lightgrey.svg"
Expand Down Expand Up @@ -147,6 +147,7 @@ There are also several flags you can pass to `anylint`:
1. `-s` / `--strict`: Fails on warnings as well. (By default, the command only fails on errors.)
1. `-x` / `--xcode`: Prints warnings & errors in a format to be reported right within Xcodes left sidebar.
1. `-l` / `--validate`: Runs only validations for `matchingExamples`, `nonMatchingExamples` and `autoCorrectExamples`.
1. `-u` / `--unvalidated`: Runs the checks without validating their correctness. Only use for faster subsequent runs after a validated run succeeded.
1. `-m` / `--measure`: Prints the time it took to execute each check for performance optimizations.
1. `-v` / `--version`: Prints the current tool version. (Does not run any lint checks.)
1. `-d` / `--debug`: Logs much more detailed information about what AnyLint is doing for debugging purposes.
Expand Down

0 comments on commit 3c1bdfc

Please sign in to comment.