Showing 1,364 of 1,364 total issues
Opening brace should be on a new line Open
public function filter($in, $out, &$consumed, $closing) {
- Exclude checks
Opening brace should be on a new line Open
public function filter($in, $out, &$consumed, $closing) {
- Exclude checks
Opening brace should be on a new line Open
private function checkBasicRule(string $rule, string $path): bool {
- Exclude checks
Opening brace should be on a new line Open
public function getDelay(string $userAgent = "*", string $type = Directive::CRAWL_DELAY) {
- Exclude checks
Opening brace should be on a new line Open
public function filter($in, $out, &$consumed, $closing) {
- Exclude checks
Opening brace should be on a new line Open
private function checkHttpStatusCodeRule(): bool {
- Exclude checks
Opening brace should be on a new line Open
protected function prepareRegexRule(string $value): string {
- Exclude checks
Opening brace should be on a new line Open
public function isDisallowed(string $url, string $userAgent = '*'): bool {
- Exclude checks
Opening brace should be on a new line Open
public function getContentIterated(): \Generator {
- Exclude checks
Opening brace should be on a new line Open
public static function fromStream($stream): self {
- Exclude checks
Opening brace should be on a new line Open
protected function setStream($stream): GeneratorBasedReader {
- Exclude checks
Opening brace should be on a new line Open
public static function fromString(string $input = ''): self {
- Exclude checks
Opening brace should be on a new line Open
public function getContentRaw(): string {
- Exclude checks
Opening brace should be on a new line Open
public function setEncoding(string $encoding) {
- Exclude checks
The variable $error_msg is not named in camelCase. Open
private function checkHostRule($rule) {
if (!isset($this->url)) {
$error_msg = WarmingMessages::INLINED_HOST;
$this->log($error_msg, [], LogLevel::ERROR);
return false;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
The variable $error_msg is not named in camelCase. Open
private function checkHostRule($rule) {
if (!isset($this->url)) {
$error_msg = WarmingMessages::INLINED_HOST;
$this->log($error_msg, [], LogLevel::ERROR);
return false;
- Read upRead up
- Exclude checks
CamelCaseVariableName
Since: 0.2
It is considered best practice to use the camelCase notation to name variables.
Example
class ClassName {
public function doSomething() {
$data_module = new DataModule();
}
}
Source
Define a constant instead of duplicating this literal "{useragent}" 3 times. Open
'{useragent}' => $currentUserAgent,
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Remove this commented out code. Open
// $bucket->data = preg_replace(Directive::getAllowDisallowRegex(), '', $bucket->data, -1, $skippedAllowanceValues);
- Read upRead up
- Exclude checks
Programmers should not comment out code as it bloats programs and reduces readability.
Unused code should be deleted and can be retrieved from source control history if required.
See
- MISRA C:2004, 2.4 - Sections of code should not be "commented out".
- MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
- MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
- MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"
Define a constant instead of duplicating this literal "logger" 5 times. Open
if (isset($this->params['logger']) && $this->params['logger'] instanceof LoggerInterface) {
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.
Define a constant instead of duplicating this literal "{directive}" 3 times. Open
'{directive}' => $directive,
- Read upRead up
- Exclude checks
Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.
On the other hand, constants can be referenced from many places, but only need to be updated in a single place.
Noncompliant Code Example
With the default threshold of 3:
function run() { prepare('action1'); // Non-Compliant - 'action1' is duplicated 3 times execute('action1'); release('action1'); }
Compliant Solution
ACTION_1 = 'action1'; function run() { prepare(ACTION_1); execute(ACTION_1); release(ACTION_1); }
Exceptions
To prevent generating some false-positives, literals having less than 5 characters are excluded.