Code Monkey home page Code Monkey logo

tuist-plugin-lint's Introduction

Tuist SwiftLint plugin

A plugin that extends Tuist with SwiftLint functionalities.

Install

In order to tell Tuist you'd like to use SwiftLint plugin in your project follow the instructions that are described in Tuist documentation.

Usage

The plugin provides a command for linting the Swift code of your projects by leveraging SwiftLint. All you need to do is run the following command:

tuist lint

You can lint selected target by specifing its name:

tuist lint MyTarget

Arguments

Argument Short Description Default Required
--path -p The path to the directory that contains the workspace or project whose code will be linted. Current directory No
--strict -s Upgrades warnings to serious violations (errors). No No

For additional help you can call:

tuist lint help

Subcommands

Subcommand Description
tuist lint version-swiftlint Outputs the current version of SwiftLint.
tuist lint version Outputs the current version of the plugin.

Contribute

To start working on the project, you can follow the steps below:

  1. Clone the project.
  2. Run Package.swift file.

tuist-plugin-lint's People

Contributors

danieleformichelli avatar fortmarek avatar laxmorek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tuist-plugin-lint's Issues

Add Plugin Directly to Repo Sample Project - fixtures/Example1

The current sample project located under fixtures/Example1 is missing any direct interaction or local import of the sample Lint Plugin providing no executable demonstration of the plugin.

If the following is ran from the sample project:

tuist tuist-lint
tuist lint

The result will always lead to

Error: Unexpected argument 'tuist-lint'
Usage: tuist [--help-env] <subcommand>

and so on.

Unfortunately, adding a simple config to the sample project and referencing the plugin led to the same result, so I'm unsure if there's a concrete example of using a locally define plugin on Github today.

swift run does work at a project root level for this sample, but that's just executing the top level package rather using tuist to execute a plugin.

Test project doesn't lint

When I try to run tuist lint on test or any other project it throws

Error: The project's graph can not be found.

tuist lint --help is giving the help provided by tuist instead of the lint

Environment

  • Tuist version: 3.16.0
  • tuist-plugin-lint: 0.3.0

Current behavior

After installing tuist-plugin-lint and running tuist lint --help as the README.md says, it gives the tuist's help instead of the linter one.

OVERVIEW: Generate, build and test your Xcode projects.

USAGE: tuist [--help-env] <subcommand>

OPTIONS:
  --help-env              Display subcommands to manage the environment tuist
                          versions.
  -h, --help              Show help information.

SUBCOMMANDS:
  build                   Builds a project
  cache                   A set of utilities related to the caching of targets.
  clean                   Clean all the artifacts stored locally
  dump                    Outputs the manifest as a JSON
  edit                    Generates a temporary project to edit the project in
                          the current directory
  fetch                   Fetches any remote content necessary to interact with
                          the project.
  generate                Generates an Xcode workspace to start working on the
                          project.
  graph                   Generates a graph from the workspace or project in
                          the current directory
  init                    Bootstraps a project
  cloud                   A set of commands to interact with the cloud.
  migration               A set of utilities to assist in the migration of
                          Xcode projects to Tuist.
  plugin                  A set of commands for plugin's management.
  run                     Runs a scheme or target in the project
  scaffold                Generates new project based on a template
  signing                 A set of commands for signing-related operations
  test                    Tests a project
  version                 Outputs the current version of tuist

  See 'tuist help <subcommand>' for detailed help.

Observations: If I run tuist lint the command works as expected.

Expected behavior

When running tuist lint --help the output must be:

OVERVIEW: A plugin that extends Tuist with linting code using SwiftLint.

USAGE: plugin-lint <subcommand>

OPTIONS:
  -h, --help              Show help information.

SUBCOMMANDS:
  swiftlint (default)     Lints the code of your projects using SwiftLint.
  version                 Outputs the current version of the plugin.
  version-swiftlint       Outputs the current version of SwiftLint.

  See 'plugin-lint help <subcommand>' for detailed help.

Exclude Intent Definition files from linting

Currently, when the plugin extracts the sources from targets, this includes '.intentdefinition' files as well as Swift files. It then lints these as if they contain Swift code when they are instead an XML file. This causes various warnings, most often due to it thinking '{}' characters are closures, when they are instead used for string interpolation.

With the regular SwiftLint binary this is handled via the '.swiftlint' file where you can exclude files or file paths from linting. Currently, there doesn't seem to be a way to customise this via the plugin.

Firstly, we can exclude this file type from linting, or perhaps we could exclude all non-Swift files? I believe SwiftLint only works on Swift sources so we could exclude all non '.swift' files maybe?

--Fix Parameter Usage

I was looking into the plugin and was curious if the --fix parameter on SwiftLint is possible to be used on the plugin but couldn't find it.

Honour excluded files within SwiftLint config file

When using the regular SwiftLint binary it can extract customisations from a .swiftlint config file, such as opt-in rules to enable, rules to disable, configurations for different rules and files to exclude. This currently doesn't seem to be possible when using the plugin as it instead intelligently works out the files to lint.

It should involve looking at how the SwiftLint CLI target extracts customisations from this config file and how it passes it to the SwiftLintFramework, that this plugin is using internally.

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.