Comments (7)
I have also experienced this same issue.
This config file also does not work
<?xml version="1.0"?>
<ruleset name="Coding Standards">
<description>coding standards</description>
<file>./src</file>
<rule ref="PSR2"/>
<rule ref="PSR12"/>
<rule ref="ObjectCalisthenics\Sniffs\Metrics\MaxNestingLevelSniff">
<properties>
<property name="maxNestingLevel" value="2" />
</properties>
</rule>
</ruleset>
and produces ERROR: Referenced sniff "ObjectCalisthenics\Sniffs\Metrics\MaxNestingLevelSniff" does not exist
from phpcs-calisthenics-rules.
@Bittarman, I still don't know how to fix that issue. So I changed to symplify/easy-coding-standard, the configuration file is simple as they say and it works in conjunction with this package.
Let me know if that also worked for you.
from phpcs-calisthenics-rules.
Guys, let me know if I can close this one.
from phpcs-calisthenics-rules.
@amandiobm This can be resolved with different configuration.
I will submit a PR for updated docs shortly
from phpcs-calisthenics-rules.
Hi,
have you tried using class instead?
ObjectCalisthenics\Sniffs\Metrics\MaxNestingLevelSniff
It's less magical and more clear than string naming
from phpcs-calisthenics-rules.
I am facing the same issue with ObjectCalisthenics.Files.FunctionLength
too.
<?xml version="1.0"?>
<ruleset name="Coding Standards">
<description>coding standards</description>
<file>./src</file>
<rule ref="PSR2"/>
<rule ref="PSR12"/>
<rule ref="ObjectCalisthenics.Files.FunctionLength">
<properties>
<property name="maxLength" value="20"/>
</properties>
</rule>
</ruleset>
bash-5.0# ./vendor/bin/phpcs -v
Registering sniffs in the Coding Standards standard... ERROR: Referenced sniff "ObjectCalisthenics\Sniffs\Metrics\MaxNestingLevelSniff" does not exist
Run "phpcs --help" for usage information
How to reproduce
# Dockerfile
FROM composer:latest
COPY . /app
WORKDIR /app
RUN composer install
ENTRYPOINT [ "/app/vendor/bin/phpcs", "-v" ]
<?php
// ./src/sample.php
declare(strict_types=1);
namespace MyVendor\MyPackage;
class MyClass
{
/**
* General-purpose dummy function.
*
* @param string $data
*
* @return string Returns the same value of the given parameter.
*/
public function parrotry(string $data): string
{
return $data;
}
}
{
"require-dev": {
"squizlabs/php_codesniffer": "^3.5",
"object-calisthenics/phpcs-calisthenics-rules": "^3.7"
}
}
$ ls
Dockerfile composer.json phpcs.xml src
$ docker build -t sample:local .
...
$ docker run --rm sample:local
Registering sniffs in the Coding Standards standard... ERROR: Referenced sniff "ObjectCalisthenics.Files.FunctionLength" does not exist
Run "phpcs --help" for usage information
$ # Envs
$ docker run --rm --entrypoint composer sample:local --version
Composer version 1.10.6 2020-05-06 10:28:10
$ docker run --rm --entrypoint composer sample:local show
nette/utils v3.1.2 🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.
object-calisthenics/phpcs-calisthenics-rules v3.7.0 PHP CodeSniffer Object Calisthenics rules/sniffs
phpstan/phpdoc-parser 0.4.4 PHPDoc parser with support for nullable, intersection and generic types
slevomat/coding-standard 6.3.8 Slevomat Coding Standard for PHP_CodeSniffer complements Consistence Coding Standard by providing sniffs with additional checks.
squizlabs/php_codesniffer 3.5.5 PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.
from phpcs-calisthenics-rules.
Closing as repository is deprecated. We migrated to PHPStan rules.
See https://tomasvotruba.com/blog/2020/09/07/introducing-object-calisthenics-rules-for-phpstan/
from phpcs-calisthenics-rules.
Related Issues (20)
- Impossible to suppress ObjectCalisthenics.Metrics.MethodPerClassLimit HOT 1
- Only one level ? And what abouht try catch ? HOT 6
- Only one level ? But how can you manage to exit a foreach ? HOT 14
- Question about Fluent Interfaces HOT 6
- Upgrade to CodeSniffer 3
- Allow "up" for short method names
- Multiline function definition should probably be counted as 1 line HOT 12
- How to do overrides HOT 10
- Missing ObjectCalisthenics/Sniffs/Files/ClassElementLengthSniff.php HOT 13
- Release v3.0? HOT 4
- Missing dependency in v3.0 HOT 1
- Usage with phpcs pear package or standalone phpcs.phar HOT 24
- Request: 2.* release with phpcodesniffer-standard HOT 6
- Nette\Utils\Strings not found HOT 6
- False positive of `ObjectCalisthenics\Sniffs\CodeAnalysis\OneObjectOperatorPerLineSniff` HOT 2
- Class 'Nette\Utils\Strings' not found possible problem with phpcs 3.2.3 ? HOT 4
- packagist.org don't contain v3.5.1 HOT 8
- Unexpected value on getStructureLengthInLines HOT 2
- requires slevomat/coding-standard ^5.0.4 but it has already installed 6.0.1 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phpcs-calisthenics-rules.