eric7.Plugins.CheckerPlugins.CodeStyleChecker.Miscellaneous.MiscellaneousChecker

Module implementing a checker for miscellaneous checks.

Global Attributes

None

Classes

MiscellaneousChecker Class implementing a checker for miscellaneous checks.

Functions

pairwise


MiscellaneousChecker

Class implementing a checker for miscellaneous checks.

Derived from

CodeStyleTopicChecker

Class Attributes

BuiltinsWhiteList
Category
Codes
FormatFieldRegex
Formatter

Class Methods

None

Methods

MiscellaneousChecker Constructor
__checkBugBear Private method for bugbear checks.
__checkBuiltins Private method to check, if built-ins are shadowed.
__checkCoding Private method to check the presence of a coding line and valid encodings.
__checkCommentedCode Private method to check for commented code.
__checkComprehensions Private method to check some comprehension related things.
__checkConstantModification Private method to check constant modifications.
__checkCopyright Private method to check the presence of a copyright statement.
__checkDateTime Private method to check use of naive datetime functions.
__checkDefaultMatchCase Private method to check the default match case.
__checkDictWithSortedKeys Private method to check, if dictionary keys appear in sorted order.
__checkExplicitStringConcat Private method to check for explicitly concatenated strings.
__checkFormatString Private method to check string format strings.
__checkFuture Private method to check the __future__ imports.
__checkGettext Private method to check the 'gettext' import statement.
__checkImplicitStringConcat Private method to check for implicitly concatenated strings.
__checkLineContinuation Private method to check line continuation using backslash.
__checkPep3101 Private method to check for old style string formatting.
__checkPrintStatements Private method to check for print statements.
__checkProperties Private method to check for issue with property related methods.
__checkReturn Private method to check return statements.
__checkSysVersion Private method to check the use of sys.version and sys.version_info.
__checkTuple Private method to check for one element tuples.
__dictShouldBeChecked Private function to test, if the node should be checked.
__getCoding Private method to get the defined coding of the source.
__getFields Private method to extract the format field information.
__isImplicitStringConcat Private method to check, if the given strings indicate an implicit string concatenation.

Static Methods

None

MiscellaneousChecker (Constructor)

MiscellaneousChecker(source, filename, tree, select, ignore, expected, repeat, args)

Constructor

source (list of str)
source code to be checked
filename (str)
name of the source file
tree (ast.Module)
AST tree of the source code
select (list of str)
list of selected codes
ignore (list of str)
list of codes to be ignored
expected (list of str)
list of expected codes
repeat (bool)
flag indicating to report each occurrence of a code
args (dict)
dictionary of arguments for the miscellaneous checks

MiscellaneousChecker.__checkBugBear

__checkBugBear()

Private method for bugbear checks.

MiscellaneousChecker.__checkBuiltins

__checkBuiltins()

Private method to check, if built-ins are shadowed.

MiscellaneousChecker.__checkCoding

__checkCoding()

Private method to check the presence of a coding line and valid encodings.

MiscellaneousChecker.__checkCommentedCode

__checkCommentedCode()

Private method to check for commented code.

MiscellaneousChecker.__checkComprehensions

__checkComprehensions()

Private method to check some comprehension related things.

This method is adapted from: flake8-comprehensions v3.16.0 Original: Copyright (c) 2017 Adam Johnson

MiscellaneousChecker.__checkConstantModification

__checkConstantModification()

Private method to check constant modifications.

MiscellaneousChecker.__checkCopyright

__checkCopyright()

Private method to check the presence of a copyright statement.

MiscellaneousChecker.__checkDateTime

__checkDateTime()

Private method to check use of naive datetime functions.

MiscellaneousChecker.__checkDefaultMatchCase

__checkDefaultMatchCase()

Private method to check the default match case.

MiscellaneousChecker.__checkDictWithSortedKeys

__checkDictWithSortedKeys()

Private method to check, if dictionary keys appear in sorted order.

MiscellaneousChecker.__checkExplicitStringConcat

__checkExplicitStringConcat()

Private method to check for explicitly concatenated strings.

MiscellaneousChecker.__checkFormatString

__checkFormatString()

Private method to check string format strings.

MiscellaneousChecker.__checkFuture

__checkFuture()

Private method to check the __future__ imports.

MiscellaneousChecker.__checkGettext

__checkGettext()

Private method to check the 'gettext' import statement.

MiscellaneousChecker.__checkImplicitStringConcat

__checkImplicitStringConcat()

Private method to check for implicitly concatenated strings.

MiscellaneousChecker.__checkLineContinuation

__checkLineContinuation()

Private method to check line continuation using backslash.

MiscellaneousChecker.__checkPep3101

__checkPep3101()

Private method to check for old style string formatting.

MiscellaneousChecker.__checkPrintStatements

__checkPrintStatements()

Private method to check for print statements.

MiscellaneousChecker.__checkProperties

__checkProperties()

Private method to check for issue with property related methods.

MiscellaneousChecker.__checkReturn

__checkReturn()

Private method to check return statements.

MiscellaneousChecker.__checkSysVersion

__checkSysVersion()

Private method to check the use of sys.version and sys.version_info.

MiscellaneousChecker.__checkTuple

__checkTuple()

Private method to check for one element tuples.

MiscellaneousChecker.__dictShouldBeChecked

__dictShouldBeChecked(node)

Private function to test, if the node should be checked.

node (ast.Dict)
reference to the AST node
Return:
flag indicating to check the node
Return Type:
bool

MiscellaneousChecker.__getCoding

__getCoding()

Private method to get the defined coding of the source.

Return:
tuple containing the line number and the coding
Return Type:
tuple of int and str

MiscellaneousChecker.__getFields

__getFields(string)

Private method to extract the format field information.

string (str)
format string to be parsed
Return:
format field information as a tuple with fields, implicit field definitions present and explicit field definitions present
Return Type:
tuple of set of str, bool, bool

MiscellaneousChecker.__isImplicitStringConcat

__isImplicitStringConcat(first, second)

Private method to check, if the given strings indicate an implicit string concatenation.

first (tuple)
first token
second (tuple)
second token
Return:
flag indicating an implicit string concatenation
Return Type:
bool
Up


pairwise

pairwise(iterable)
Up