Skip to content

Commit

Permalink
fix bins
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Jul 17, 2023
1 parent ab122fb commit 629e652
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 113 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ Find leaking classes that you never use... and get rif of them.
## Install

```bash
composer require tomas-votruba/class-leak --dev
composer require tomasvotruba/class-leak --dev
```

## Usage

How to avoid it? Add check to your CI:

```bash
vendor/bin/class-leak .
vendor/bin/class-leak bin src
```
6 changes: 3 additions & 3 deletions build/build-scoped.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ ls -l $RESULT_DIRECTORY
note "Dumping Composer Autoload"
composer dump-autoload --working-dir "$RESULT_DIRECTORY" --ansi --classmap-authoritative --no-dev

# make bin/easy-ci runnable without "php"
chmod 777 "$RESULT_DIRECTORY/bin/easy-ci"
chmod 777 "$RESULT_DIRECTORY/bin/easy-ci.php"
# make bin/class-leak runnable without "php"
chmod 777 "$RESULT_DIRECTORY/bin/class-leak"
chmod 777 "$RESULT_DIRECTORY/bin/class-leak.php"

note "Finished"
2 changes: 1 addition & 1 deletion build/target-repository/.github/workflows/bare_run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
php-version: ${{ matrix.php_version }}
coverage: none

- run: php bin/easy-ci list --ansi
- run: php bin/class-leak list --ansi
109 changes: 5 additions & 104 deletions build/target-repository/README.md
Original file line number Diff line number Diff line change
@@ -1,118 +1,19 @@
# Easy CI
# Class Leak

[![Downloads total](https://img.shields.io/packagist/dt/symplify/easy-ci.svg?style=flat-square)](https://packagist.org/packages/symplify/easy-ci/stats)
[![Downloads total](https://img.shields.io/packagist/dt/tomas-votruba/class-leak.svg?style=flat-square)](https://packagist.org/packages/tomas-votruba/class-leak/stats)

Tools that make easy to setup CI.

- Check git conflicts in CI
- Check TWIG templates for missing classes, non-existing static calls and constant fetches
- Check YAML configs for the same
Find leaking classes that you never use... and get rif of them.

## Install

```bash
composer require symplify/easy-ci --dev
composer require tomasvotruba/class-leak --dev
```

## Usage

### 1. Check your Code for Git Merge Conflicts

Do you use Git? Then merge conflicts is not what you want in your code ever to see:

```bash
<<<<<<< HEAD
this is some content to mess with
content to append
=======
totally different content to merge later
````

How to avoid it? Add check to your CI:

```bash
vendor/bin/easy-ci check-conflicts .
```

The `/vendor` directory is excluded by default.

<br>

### 2. Check Configs for Non-Existing Classes

```bash
vendor/bin/easy-ci check-config src
```

Supported types are YAML.

<br>

### 3. Check Twig Controller Paths

```bash
vendor/bin/easy-ci check-twig-render src/Controller
```

```php
final class SomeController
{
public function index()
{
return $this->render('does_path_exist.twig');
}
}
```

<br>

### 4. Detect Static Calls in Your Code

```bash
vendor/bin/easy-ci detect-static src
vendor/bin/class-leak bin src
```

<br>

### 5. Detect Commented Code

Have you ever forgot commented code in your code?

```php
// foreach ($matches as $match) {
// $content = str_replace($match[0], $match[2], $content);
// }
```
Clutter no more! Add `check-commented-code` command to your CI and don't worry about it:
```bash
vendor/bin/easy-ci check-commented-code <directory>
vendor/bin/easy-ci check-commented-code packages --line-limit 5
```
### 6. Short File === Class Name
Does short file name matches the class name?
```bash
vendor/bin/easy-ci check-file-class-name src
```
### 7. Avoid 2 classes in 1 File
What files have 2 and more classes?
```bash
vendor/bin/easy-ci find-multi-classes tests
```
<br>
## Report Issues
In case you are experiencing a bug or want to request a new feature head over to the [Symplify monorepo issue tracker](https://github.com/symplify/symplify/issues)
## Contribute
The sources of this package are contained in the Symplify monorepo. We welcome contributions for this package on [symplify/symplify](https://github.com/symplify/symplify).
6 changes: 3 additions & 3 deletions prefix-code.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ mv scoped-code/* .
note "Dumping Composer Autoload"
composer dump-autoload --ansi --classmap-authoritative --no-dev

# make bin/ecs runnable without "php"
chmod 777 "bin/easy-ci"
chmod 777 "bin/easy-ci.php"
# make bin runnable without "php"
chmod 777 "bin/class-leak"
chmod 777 "bin/class-leak.php"

note "Finished"

0 comments on commit 629e652

Please sign in to comment.