Mixins provided by mtrchk.org.momotor.evaluate.compare

checklet mixin class mtrchk.org.momotor.evaluate.compare.mixin.CompareMixin
ignore-final-newline option

Ignore difference in final newline

Type:

boolean

Required:

False

Multiple:

False

Location:

config, step, recipe

Default:

False

ignore-trailing-whitespace option

Ignore difference in trailing whitespace for all lines

Type:

boolean

Required:

False

Multiple:

False

Location:

config, step, recipe

Default:

False

sort-left option

Sort the left file before comparison. Either a boolean value (yes, no, true, false, etc.), or human, nat, os, real to sort using a natural sort algorithm.

See the documentation of the natsort package for details on the natural sort algorithms.

Note

Sorting requires the entire file to be read into memory, which may be undesirable for large files.

Type:

string

Required:

False

Multiple:

False

Location:

config, step, recipe

Default:

False

sort-right option

Sort the right file before comparison. Either a boolean value (yes, no, true, false, etc.), or human, nat, os, real to sort using a natural sort algorithm.

See the documentation of the natsort package for details on the natural sort algorithms.

Note

Sorting requires the entire file to be read into memory, which may be undesirable for large files.

Type:

string

Required:

False

Multiple:

False

Location:

config, step, recipe

Default:

False

pass-level option

When to pass the compare:

  • identical: Contents must be fully identical

  • case: Contents may differ in whitespace, blank lines and casing

  • whitespace: Contents may differ in whitespace only (excluding blank lines)

  • blank: Contents may differ in whitespace and blank lines

  • different: Contents may differ completely. This will make this step always pass.

Later listed passing levels include earlier listed levels, e.g. if the detected level is whitespace, the files may also include differences in case.

Type:

Any

Required:

False

Multiple:

False

Location:

config, step, recipe

Default:

identical

score option

Score when passing a level. A (possibly empty) comma separated list of scores for each level:

[ [ identical-score ] 
    [ "," [ case-score ] 
        [ "," [ whitespace-score ] 
            [ "," [ blank-score ]  
                [ "," [ different-score ] ] 
            ] 
        ] 
    ] 
]

Missing values at the end will be the same as the last value in the list, an empty value means no score will be given for that level.

For example, a score definition of 10,9,8 will give a score of 10 when the files are identical, 9 when they differ only in case, and 8 otherwise.

Type:

Any

Required:

False

Multiple:

False

Location:

config, step, recipe

Default:

Empty string

score-fail option

Score when failing to meet the required level. Either a constant score value, string constant none to indicate no score when failing, or keep to keep the score from the score list.

Type:

Any

Required:

False

Multiple:

False

Location:

config, step, recipe

Default:

none

fail-with-reason option

When failing, set the reason property. If false the reason is listed as the status

Type:

boolean

Required:

False

Multiple:

False

Location:

config, step, recipe

Default:

True

compare_report(left, right)

Compare two files and return a CheckletResult with the outcome and properties based on the given options and the level of difference of the files.

Parameters:
  • left (File) – Left file

  • right (File) – Right file

Return type:

CheckletResult

Returns:

The result

Raises:

CheckletError – if an option value is invalid