Coder Social home page Coder Social logo

php-cs-fixer-commit's Introduction

php-cs-fixer-commit

Installation

$ composer require --dev enomotodev/php-cs-fixer-commit

Usage (GitHub + GitHub Actions)

Create workflow file

In .github/workflows , add a .yml or .yaml file for your workflow.

For example, .github/workflows/php-cs-fixer-commit.yml .

name: php-cs-fixer-commit

on:
  push:

jobs:
  php-cs-fixer-commit:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Install Dependencies
        run: composer install
      - name: php-cs-fixer-commit
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: ./vendor/bin/php-cs-fixer-commit <username> <email>

NOTE: Please make sure you replace <username> and <email> with yours.

Usage (GitHub + CircleCI)

Setting GitHub personal access token to CircleCI

GitHub personal access token is required for sending pull requests to your repository.

  1. Go to your account's settings page and generate a personal access token with "repo" scope
  2. On CircleCI dashboard, go to your application's "Project Settings" -> "Environment Variables"
  3. Add an environment variable GITHUB_ACCESS_TOKEN with your GitHub personal access token

Configure circle.yml

Configure your circle.yml or .circleci/config.yml to run php-cs-fixer-commit, for example:

version: 2

jobs:
  build:
    # ...
    fixer:
      steps:
        # ...
        - run:
            name: php-cs-fixer-commit
            command: ./vendor/bin/php-cs-fixer-commit <username> <email>

NOTE: Please make sure you replace <username> and <email> with yours.

Usage (GitLab + GitLabCI)

Setting GitLab personal access token to GitLabCI

GitLab personal access token is required for sending merge requests to your repository.

  1. Go to your account's settings page and generate a personal access token with "api" scope
  2. On GitLab dashboard, go to your application's "Settings" -> "CI /CD" -> "Environment variables"
  3. Add an environment variable GITLAB_API_PRIVATE_TOKEN with your GitLab personal access token

Configure .gitlab-ci.yml

Configure your .gitlab-ci.yml to run php-cs-fixer-commit, for example:

stages:
  # ...
  - fixer

# ...

fixer-commit:
  image: composer:latest
  stage: fixer
  script:
    - "composer install"
    - "$COMPOSER_HOME/vendor/bin/php-cs-fixer-commit <username> <email>"

NOTE: Please make sure you replace <username> and <email> with yours.

License

php-cs-fixer-commit is open-sourced software licensed under the MIT license

php-cs-fixer-commit's People

Contributors

enomotodev avatar 9bo9bo avatar ksmakey avatar

Stargazers

Vladyslav Chernyshov avatar Alexander Glück avatar Shohei Takeda avatar Omar Villafuerte avatar  avatar Luis Arce avatar oppara avatar ShoheiTai avatar  avatar Bagaskara Wisnu Gunawan avatar Irineu Martins Junior avatar  avatar takuhito hihara avatar eda avatar  avatar kosa3 avatar Tsuyoshi Eda avatar  avatar

Watchers

 avatar  avatar

php-cs-fixer-commit's Issues

[Gitlab CI] You must call one of in() or append() methods before iterating over a Finder.

Hello!
I found your software and it was exactly what I need, so thanks in advance for posting it.

I'm running into a issue when trying to integrate the php-cs-fixer-commit into a Gitlab CI pipeline.

The output complains about the PHP CS Fixer version (offtopic: could I help with this? what is needed? Upgrade composer's version and test it?) but after that it throws an error in Finder.php and then never finds any changes.

$ vendor/bin/php-cs-fixer-commit <user> <mail>
You are running PHP CS Fixer v2, which is not maintained anymore. Please update to v3.
If you need help while solving warnings, ask at https://gitter.im/PHP-CS-Fixer, we will help you!
Loaded config default.
In Finder.php line 611:
                                                                               
  You must call one of in() or append() methods before iterating over a Finde  
  r.                                                                           
                                                                               
fix [--path-mode PATH-MODE] [--allow-risky ALLOW-RISKY] [--config CONFIG] [--dry-run] [--rules RULES] [--using-cache USING-CACHE] [--cache-file CACHE-FILE] [--diff] [--diff-format DIFF-FORMAT] [--format FORMAT] [--stop-on-violation] [--show-progress SHOW-PROGRESS] [--] [<path>...]
Removing composer.lock
## HEAD (no branch)
No changes.
Cleaning up file based variables

Could someone help me with this? I've done some research, but it seems to be an issue related to PHP CS Fixer and I'm missing where and how I can change the Finder file.

Should I create a PHP CS Fixer config file in the root of the repository?

Thanks again,

Regards.

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.