RuleKind

Enum RuleKind 

Source
pub enum RuleKind {
Show 31 variants UnusedTag, UndefinedTag, EmptyBlock, UnusedAoi, UnusedDataType, CyclomaticComplexity, DeepNesting, FloatEquality, TimeEquality, DivisionByZero, MagicNumber, TimerNoReset, RecursiveCall, LoopVarModified, TooManyParameters, ExcessiveGlobals, ContinueUsed, ExitUsed, IfWithoutElse, CaseWithoutElse, ReturnInMiddle, NameTooShort, NameTooLong, AoiNoDescription, TagNoDescription, RoutineNoDescription, ProgramNoDescription, TaskWatchdogDisabled, ExcessiveTaskRate, AliasChain, LargeArray,
}
Expand description

Kind of code rule detected.

This enum contains all rule types. The open-source plceye detects the first 5 rules. Additional rules are detected by plceye-pro (commercial license).

Variants§

§

UnusedTag

S0001: Tag is defined but never used

§

UndefinedTag

S0002: Tag is used but never defined (might be external/aliased)

§

EmptyBlock

S0003: Empty routine or POU

§

UnusedAoi

S0004: AOI is defined but never called

§

UnusedDataType

S0005: DataType is defined but never used

§

CyclomaticComplexity

M0001: Cyclomatic complexity too high

§

DeepNesting

M0003: Deep nesting (> 4 levels)

§

FloatEquality

C0010: Floating-point comparison with = or <>

§

TimeEquality

C0011: TIME comparison with = or <>

§

DivisionByZero

C0014: Possible division by zero

§

MagicNumber

C0015: Magic number (hardcoded literal that should be a constant)

§

TimerNoReset

C0016: Timer/counter without reset path

§

RecursiveCall

C0031: POU calls itself recursively

§

LoopVarModified

C0032: FOR loop variable modified inside loop

§

TooManyParameters

C0050: POU has too many parameters (>7)

§

ExcessiveGlobals

C0060: Too many global variables

§

ContinueUsed

S0020: CONTINUE statement used

§

ExitUsed

S0021: EXIT statement used

§

IfWithoutElse

S0022: IF without ELSE clause

§

CaseWithoutElse

S0023: CASE without ELSE clause

§

ReturnInMiddle

S0025: RETURN not at end of POU

§

NameTooShort

N0006: Name length < 3 characters

§

NameTooLong

N0007: Name length > 30 characters

§

AoiNoDescription

X0001: AOI without description

§

TagNoDescription

X0002: Tag without description

§

RoutineNoDescription

X0003: Routine without description

§

ProgramNoDescription

X0004: Program without description

§

TaskWatchdogDisabled

X0006: Task watchdog disabled

§

ExcessiveTaskRate

X0007: Excessive task rate (<1ms)

§

AliasChain

X0009: Alias chain (alias pointing to alias)

§

LargeArray

X0010: Large array (>10000 elements)

Implementations§

Source§

impl RuleKind

Source

pub fn code(&self) -> &'static str

Get the rule code (e.g., “S0001”).

Source

pub fn name(&self) -> &'static str

Get the rule name (e.g., “unused-tag”).

Trait Implementations§

Source§

impl Clone for RuleKind

Source§

fn clone(&self) -> RuleKind

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RuleKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for RuleKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for RuleKind

Source§

fn eq(&self, other: &RuleKind) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for RuleKind

Source§

impl StructuralPartialEq for RuleKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.