GithubHelp home page GithubHelp logo

yonaskolb / projlint Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jamitlabs/projlint

0.0 3.0 0.0 177 KB

Project Linter to lint & autocorrect your non-code best practices.

License: MIT License

Swift 100.00%

projlint's Introduction

Build Status Codebeat Badge Version: 0.1.1 Swift: 4.1 Platforms: macOS | Linux License: MIT

InstallationUsageContributingLicense

ProjLint

Project Linter to lint & autocorrect your non-code best practices.

Requirements

  • Xcode 9.3+ and Swift 4.1+
  • Xcode Command Line Tools (see here for installation instructions)

Installation

Using Mint:

To install ProjLint simply run this command:

$ mint install JamitLabs/ProjLint

To update to the newest version of TranslationManager when you have an old version already installed run:

$ mint update JamitLabs/ProjLint

Usage

ProjLint provides the following sub commands:

  • lint: Lints the current directory and shows warnings and errors as console output.
  • correct: Corrects all correctable violations in the current directory.

Shared Flags:

  • --verbose, -v: Prints out more detailed information about steps taken.

Lint-only Flags:

  • --xcode, -x: Output are done in a format that is compatible with Xcode – for usage in Build Scripts.
  • --timeout, -t: Seconds to wait for network requests until skipped.
  • --ignore-network-errors, -i: Ignores network timeouts or missing network connection errors.

NOTE: It is recommended to set the options --timeout 2 and --ignore-network-errors if you plan to run projlint lint automatically on every build. Otherwise your build time might increase significantly on bad/missing internet connections.

Configuration

To configure the checks ProjLint does for you, you need to have a YAML configuration file named .projlint.yml in the current directory. In there, you have the following sections:

  • Default Options: Documented below, these options are applied to all rules unless they override them specifically.
  • Rules with Options: The list of rules to check & correct when the appropriate tasks are run with ability to customize them.
  • Shared Variables: Define String variables to be replaced in rule options using structure <:var_name:>.

In addition to the .projlint.yml file, you can also place an additional .projlint-local.yml file with the same possibilities as in the normal config file. This allows you to share the same .projlint.yml file amongst multiple projects and keep them in sync while adding project-specific rules via the -local config file. Note that defaults options and shared variables with the same keys in the -local file will override those from the normal file.

Default Options

The following default options are available:

Option Type Required? Description
lint_fail_level String no One of warning or error – specifies when the lint command should fail.
forced_violation_level String no One of warning or error – enforces the specified level on all violations.

All default options can be overridden by specifying a different value within the rule options. Here's an example:

default_options:
  lint_fail_level: error 

Rules with Options

A list of all currently available rules and their options can be found in the Rules.md file. The structure of how rules can be configures looks like the following:

rules:
  - file_existence: # rule identifier
      forced_violation_level: warning # override default option
      paths: # note the additional indentation # rule option
        - .swiftlint.yml
        - README.md
        - CONTRIBUTING.md
        - CHANGELOG.md
  - file_content_template: #rule identifier
      matching: # rule option
        .swiftlint.yml:
          template_url: "https://github.com/User/Templates/blob/stable/SwiftLint.stencil"

Shared Variables

A dictionary where you can define variables which can be used in strings anywhere amongst rule options. Say a variable named project_name was specified with the value MyAmazingProject, then all appearances of <:project_name:> in rule option strings will be replaced by MyAmazingProject. Here's what a config file using shared variables might look like:

shared_variables:
  project_name: MyAmazingProject

rules:
  - file_existence:
      paths:
        - <:project_name:>.xcodeproj
        - <:project_name:>/Sources/AppDelegate.swift

Contributing

See the file CONTRIBUTING.md.

License

This library is released under the MIT License. See LICENSE for details.

projlint's People

Contributors

jeehut avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.