# eric7.Plugins.CheckerPlugins.SyntaxChecker.SyntaxCheckService

Module implementing an interface to add different languages to do a syntax check.

### Global Attributes

None

### Classes

SyntaxCheckService | Implement the syntax check service.

### Functions

None

## SyntaxCheckService

Implement the syntax check service.

Plugins can add other languages to the syntax check by calling addLanguage and support of an extra checker module on the client side which has to connect directly to the background service.

### Signals

batchFinished()
  emitted when a syntax check batch is done
error(str, str)
  emitted in case of an error
syntaxChecked(str, dict)
  emitted when the syntax check was done for one file

### Derived from

QObject

### Class Attributes

None

### Class Methods

None

### Methods

SyntaxCheckService | Constructor
__determineLanguage | Private method to determine the language of the file.
__serviceError | Private slot handling service errors.
addLanguage | Public method to register a new language to the supported languages.
batchJobDone | Public slot handling the completion of a batch job.
cancelSyntaxBatchCheck | Public method to cancel all batch jobs.
getExtensions | Public method to return all supported file extensions for the syntax checker dialog.
getLanguages | Public method to return the supported language names.
removeLanguage | Public method to remove the language from syntax check.
serviceErrorJSON | Public method handling service errors for JSON.
serviceErrorJavaScript | Public method handling service errors for JavaScript.
serviceErrorPy3 | Public method handling service errors for Python 3.
serviceErrorTOML | Public method handling service errors for TOML.
serviceErrorYAML | Public method handling service errors for YAML.
syntaxBatchCheck | Public method to prepare a syntax check on multiple source files.
syntaxCheck | Public method to prepare a syntax check of one source file.

### Static Methods

None

#### SyntaxCheckService (Constructor)

SyntaxCheckService()

Constructor

#### SyntaxCheckService.__determineLanguage

__determineLanguage(filename, source)

Private method to determine the language of the file.

filename (str)
  of the sourcefile
source (str)
  code of the file

Return:
  language of the file or None if not found

Return Type:
  str or None

#### SyntaxCheckService.__serviceError

__serviceError(fn, msg)

Private slot handling service errors.

fn (str)
  file name
msg (str)
  message text

#### SyntaxCheckService.addLanguage

addLanguage(lang, env, path, module, getArgs, getExt, callback, onError)

Public method to register a new language to the supported languages.

lang (str)
  new language to check syntax
env (str)
  the environment in which the checker is implemented
path (str)
  full path to the module
module (str)
  name to import
getArgs (function)
  function to collect the required arguments to call the syntax checker on client side
getExt (function)
  function that returns the supported file extensions of the syntax checker
callback (function)
  function on service response
onError (function)
  callback function if client or service isn't available

#### SyntaxCheckService.batchJobDone

batchJobDone(fx, lang)

Public slot handling the completion of a batch job.

fx (str)
  service name
lang (str)
  language

#### SyntaxCheckService.cancelSyntaxBatchCheck

cancelSyntaxBatchCheck()

Public method to cancel all batch jobs.

#### SyntaxCheckService.getExtensions

getExtensions()

Public method to return all supported file extensions for the syntax checker dialog.

Return:
  set of all supported file extensions

Return Type:
  set of str

#### SyntaxCheckService.getLanguages

getLanguages()

Public method to return the supported language names.

Return:
  list of languanges supported

Return Type:
  list of str

#### SyntaxCheckService.removeLanguage

removeLanguage(lang)

Public method to remove the language from syntax check.

lang (str)
  language to remove

#### SyntaxCheckService.serviceErrorJSON

serviceErrorJSON(fx, lang, fn, msg)

Public method handling service errors for JSON.

fx (str)
  service name
lang (str)
  language
fn (str)
  file name
msg (str)
  message text

#### SyntaxCheckService.serviceErrorJavaScript

serviceErrorJavaScript(fx, lang, fn, msg)

Public method handling service errors for JavaScript.

fx (str)
  service name
lang (str)
  language
fn (str)
  file name
msg (str)
  message text

#### SyntaxCheckService.serviceErrorPy3

serviceErrorPy3(fx, lang, fn, msg)

Public method handling service errors for Python 3.

fx (str)
  service name
lang (str)
  language
fn (str)
  file name
msg (str)
  message text

#### SyntaxCheckService.serviceErrorTOML

serviceErrorTOML(fx, lang, fn, msg)

Public method handling service errors for TOML.

fx (str)
  service name
lang (str)
  language
fn (str)
  file name
msg (str)
  message text

#### SyntaxCheckService.serviceErrorYAML

serviceErrorYAML(fx, lang, fn, msg)

Public method handling service errors for YAML.

fx (str)
  service name
lang (str)
  language
fn (str)
  file name
msg (str)
  message text

#### SyntaxCheckService.syntaxBatchCheck

syntaxBatchCheck(argumentsList)

Public method to prepare a syntax check on multiple source files.

argumentsList (list of tuples of (str, str))
  list of argument tuples with each tuple containing filename and source

#### SyntaxCheckService.syntaxCheck

syntaxCheck(lang, filename, source, *args)

Public method to prepare a syntax check of one source file.

lang (str or None)
  language of the file or None to determine by internal algorithm
filename (str)
  source filename
source (str)
  string containing the code to check
args (tuple)
  tuple containing additional positional arguments

Up