PyCharm 2019.3 Help

Scope Language Syntax Reference

The scopes language is used in specifying project scopes involved in the various kinds of analysis.

Sets of files

  • Single file is defined by a filename, i.e. MyDir/MyFile.txt

  • Set of all files in a directory, not recursing into subdirectories, is defined by an asterisk after slash, for example: file:src/main/myDir/*

  • Set of all files in a directory including contents of subdirectories, is defined by an asterisk after double slash, for example file:src/main/myDir//*

Logical operators

The scope language allows you to use common logical operators:

&& for AND || for OR ! for NOT

Besides that, the parentheses can be used to join the logical operators into groups. For example, the following scope

(<a>||<b>)&&<c>

implies either <a> and <c>, or <b> and <c>.

Create a new scope from existing scopes

You can compile a new scope from several existing scopes. In this case, you can reference the existing scopes by using $ $MyScope.

For example, the $Scope1||$Scope2 pattern places in a scope all files from Scope1 and Scope2.

Defining scopes

Scopes are defined in the Scopes dialog box in the following ways:

  • Manually

  • With the pointing device

Manually
Specify file masks in the Pattern text box, or click icons general expandComponent and type the pattern in the editor.
Using the Mouse Pointer
Select files and folders in the project tree view and click the buttons Include, Include Recursively, Exclude, and Exclude Recursively. For information about the controls, refer to Scope page description.

Based on the inclusion/exclusion of file and directories, PyCharm creates an expression and displays it in the Pattern field.

Examples

  • file:*.js||file:*.coffee - include all JavaScript and CoffeeScript files.

  • file:*js&&!file:*.min.* - include all JavaScript files except those that were generated through minification, which is indicated by the min extension.

  • file[Scientific_Sample]:*.py - include all Python files from the project Scientific_Sample. Specifying the project name in the brackets is particularly helpful when you have several projects attached to the current one.

    Example of a scope created for two attached projects

Last modified: 2 April 2020