Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor entire project with new YAML-based config approach #43

Open
wants to merge 37 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
b630747
Migrate from Swift script to YAML based config
Jeehut Jun 22, 2021
0fd6de3
Migrate from SwiftLint to Apples Swift-Format
Jeehut Jun 22, 2021
f8778f2
Start refactoring: Fully migrate to ArgumentParser
Jeehut Jun 28, 2021
d8497a7
Move most reusable files to correct new module
Jeehut Jul 2, 2021
fc6c0e3
Implement basic init command with blank template
Jeehut Jul 2, 2021
8e474e3
[README.md] Add YAML cheat sheet
Jeehut Jul 2, 2021
3e5adca
[Incomplete] Move all previous files to new places
Jeehut Jul 8, 2021
38e1dee
Re-enact most out-commented code with new approach
Jeehut Jul 9, 2021
0aa7199
Move tests to new split structure & comment out
Jeehut Jul 31, 2021
447f8bd
Update .gitignore file for Swift packages
Jeehut Jul 31, 2021
52d6a06
Add tests stubs for all targets
Jeehut Jul 31, 2021
56d33bd
Reconfigure GitHub Actions & downgrade Swift
Jeehut Aug 15, 2021
76dd519
Add tests for `Template` file in `Configuration` target
Jeehut Aug 15, 2021
f837251
Update template contents & test expectations
Jeehut Aug 15, 2021
e2754a6
Fix empty YAML array issue & document next TODO
Jeehut Aug 15, 2021
3f46159
Fix default value issue & add sample custom script
Jeehut Aug 26, 2021
25f4089
Re-add adjusted tests for Core library + refactor
Jeehut Aug 31, 2021
7b5ecd0
Complete tests in Core library
Jeehut Sep 1, 2021
9078930
Implement out-commented code in LintResults type
Jeehut Sep 3, 2021
8973d66
Add more LintResults tests + refactor FileLocation
Jeehut Sep 4, 2021
2e79244
Complete LintResults tests to reach high coverage
Jeehut Sep 5, 2021
4199b7a
Refactor files in project + start re-adding tests
Jeehut Sep 5, 2021
5bd9ac7
Re-enable uncommented test code for Checkers
Jeehut Sep 5, 2021
e7cc711
Write custom script tests + some refactoring
Jeehut Sep 7, 2021
8b4416d
Fix LintResults coding issues + rename CheckInfo
Jeehut Sep 7, 2021
791b963
Fully test & fix implementation of custom scripts
Jeehut Sep 7, 2021
f778aed
Cover missing tests & cleanup unused files
Jeehut Sep 11, 2021
1977905
Fix tests when not running from within Xcode
Jeehut Sep 11, 2021
a865f9b
Fix test issue with unordered dictionary on Linux
Jeehut Sep 11, 2021
81e54ea
Add CI tests targeting Windows platform
Jeehut Sep 11, 2021
9b693e6
Remove unnecessary argument + add to main tests
Jeehut Sep 11, 2021
c566b0b
Add CI limit on Windows + start improving CLI
Jeehut Sep 12, 2021
d343473
Upgrade Windows Swift tooling to 5.5 dev snapshot
Jeehut Sep 12, 2021
584f603
Fix issues with templates & simplify Windows CI
Jeehut Sep 12, 2021
0bbe6cf
Fix an issue with decoding Violation without date
Jeehut Sep 13, 2021
1fee0c0
Add temporary workaround for a Date coding issue
Jeehut Sep 13, 2021
3679098
Add workaround for Codable date encoding issue
Jeehut Sep 13, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100 changes: 13 additions & 87 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,88 +1,10 @@
name: CI
name: Main

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/[email protected]
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 "::set-env name=ANYLINT_LATEST_VERSION::$( latest_version Flinesoft/AnyLint )"
echo "::set-env name=SWIFT_SH_LATEST_VERSION::$( latest_version mxcl/swift-sh )"

- 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

- name: Cleanup checkouts
run: rm -rf AnyLint && rm -rf swift-sh

- name: Run AnyLint
run: anylint

swiftlint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Run SwiftLint
uses: norio-nomura/[email protected]
with:
args: --strict

test-linux:
runs-on: ubuntu-latest

Expand All @@ -92,7 +14,6 @@ jobs:
- name: Run tests
run: swift test -v


test-macos:
runs-on: macos-latest

Expand All @@ -102,10 +23,15 @@ jobs:
- 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 }}
test-windows:
runs-on: windows-latest

timeout-minutes: 15

steps:
- uses: actions/checkout@v2

- name: Install Swift & Run tests
uses: MaxDesiatov/swift-windows-action@v1
with:
shell-action: swift test -v
58 changes: 58 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Pull Request

on:
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/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

anylint:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2

- name: Install AnyLint
run: brew tap Flinesoft/AnyLint https://github.com/Flinesoft/AnyLint.git && brew install anylint

- name: Run AnyLint
run: anylint

test-linux:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Run tests
run: swift test -v

test-macos:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2

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

test-windows:
runs-on: windows-latest

timeout-minutes: 15

steps:
- uses: actions/checkout@v2

- name: Install Swift & Run tests
uses: MaxDesiatov/swift-windows-action@v1
with:
shell-action: swift test -v
95 changes: 88 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,90 @@
# macOS

# General
.DS_Store
/.build
/Packages
/*.xcodeproj
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk


# Swift

# Xcode
## User settings
xcuserdata/
/AnyLintTempTests
.codacy-coverage
*.lcov
codacy-coverage.json

## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout

## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
build/
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3

## Obj-C/Swift specific
*.hmap

## App packaging
*.ipa
*.dSYM.zip
*.dSYM

## Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
Packages/
Package.pins
Package.resolved
*.xcodeproj

# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
# hence it is not needed unless you have added a package configuration file to your project
.swiftpm
.build/

# fastlane
#
# It is recommended to not store the screenshots in the git repo.
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output

# project-specific
anylint-test-results.json
17 changes: 0 additions & 17 deletions .sourcery/LinuxMain.stencil

This file was deleted.

15 changes: 15 additions & 0 deletions .swift-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"lineBreakAroundMultilineExpressionChainComponents": true,
"lineBreakBeforeControlFlowKeywords": true,
"lineBreakBeforeEachArgument": true,
"lineBreakBeforeEachGenericRequirement": true,
"lineLength": 120,
"prioritizeKeepingFunctionOutputTogether": true,
"rules": {
"NeverUseImplicitlyUnwrappedOptionals": true,
"NoLeadingUnderscores": true,
"ValidateDocumentationComments": true,
},
"tabWidth": 2,
"version": 1,
}
Loading