Commits

zjes committed 5820b64

Add lint project settings

  • Participants
  • Parent commits d558eca

Comments (0)

Files changed (14)

src/Project/CMakeLists.txt

     Node.h
     Properties/ProjectProperties.h
     Properties/General.h
+    Properties/CodeCheck.h
 )
 
 SET(moc
     Node.cpp
     Properties/ProjectProperties.cpp
     Properties/General.cpp
+    Properties/CodeCheck.cpp
 )
 
 SET(res
 SET(ui
     Properties/ProjectProperties.ui
     Properties/General.ui
+    Properties/CodeCheck.ui
 )
 
 QT4_ADD_RESOURCES(qrc ${res})

src/Project/IProject.h

 signals:
     void interpretChanged();
     void shownFilesChanged();
+    void lintChanged();
 public slots:
     virtual void openFile(const QString& fileName, int offset = 0) = 0;
 signals:

src/Project/ProjectFile.cpp

 {
     if (interpretName() != name){
         _settings->setValue("python/interpret", name);
-        _pythonCode->deleteLater();
-        _pythonCode = NULL;
+        if (_pythonCode)
+            _pythonCode->init(interpretExec(), path(), mainScript(), _settings->fileName());
         emit interpretChanged();
     }
 }
     _settings->setValue("python/guiname", name);
 }
 
+QMap<QString, QVariant> ProjectFile::codeCheck()
+{
+    QMap<QString, QVariant> check;
+
+    check.insert("dummyVars"        , _settings->value("lint/dummyVar", "_|dummy"));
+    check.insert("badFunctions"     , _settings->value("lint/badFunc", "map, filter, apply, input"));
+    check.insert("goodNames"        , _settings->value("lint/goodNames", "i, j, k, ex, Run, _"));
+    check.insert("badNames"         , _settings->value("lint/badNames", "foo, bar, baz"));
+    check.insert("maxLineLength"    , _settings->value("lint/maxLineLength", 80));
+    check.insert("maxModuleLenght"  , _settings->value("lint/maxModLines", 1000));
+
+
+    check.insert("moduleStyle"      , _settings->value("lint/checkModule", "(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$"));
+    check.insert("constStyle"       , _settings->value("lint/checkConst", "(([A-Z_][A-Z0-9_]*)|(__.*__))$"));
+    check.insert("classStyle"       , _settings->value("lint/checkClass", "[A-Z_][a-zA-Z0-9]+$"));
+    check.insert("funcStyle"        , _settings->value("lint/checkFunc", "[a-z_][a-z0-9_]{2,30}$"));
+    check.insert("methodStyle"      , _settings->value("lint/checkMethod", "[a-z_][a-z0-9_]{2,30}$"));
+    check.insert("attrStyle"        , _settings->value("lint/checkAttr", "[a-z_][a-z0-9_]{2,30}$"));
+    check.insert("argStyle"         , _settings->value("lint/checkArg", "[a-z_][a-z0-9_]{2,30}$"));
+    check.insert("varStyle"         , _settings->value("lint/checkVar", "[a-z_][a-z0-9_]{2,30}$"));
+    check.insert("inlVarStyle"      , _settings->value("lint/checkInlineVar", "[A-Za-z_][A-Za-z0-9_]*$"));
+
+
+    check.insert("maxArgs"          , _settings->value("lint/maxArgs", 5));
+    check.insert("ignoreNames"      , _settings->value("lint/ignArgNames", "_.*"));
+    check.insert("maxLocals"        , _settings->value("lint/maxLocals", 15));
+    check.insert("maxReturns"       , _settings->value("lint/maxReturns", 6));
+    check.insert("maxBranchs"       , _settings->value("lint/maxBranchs", 12));
+    check.insert("maxStats"         , _settings->value("lint/maxStats", 50));
+    check.insert("maxParents"       , _settings->value("lint/maxParents", 7));
+    check.insert("maxAttr"          , _settings->value("lint/maxAttrs", 7));
+    check.insert("minPublic"        , _settings->value("lint/minPublic", 2));
+    check.insert("maxPublic"        , _settings->value("lint/maxPublic", 20));
+
+    check.insert("useStyle"         , _settings->value("lint/style", 0));
+
+    return check;
+}
+
+#define SETINT(confname, mapname) \
+    if (_settings->value(confname).toInt() != check[mapname].toInt()){ \
+        changed |= true; \
+        _settings->setValue(confname, check[mapname]); \
+    }
+
+#define SETTEXT(confname, mapname) \
+    if (_settings->value(confname, "").toString() != check[mapname].toString()){ \
+        changed |= true; \
+        _settings->setValue(confname, check[mapname]); \
+    }
+
+void ProjectFile::setCodeCheck(const QMap<QString, QVariant>& check)
+{
+    bool changed = false;
+
+    SETTEXT("lint/dummyVar"      , "dummyVars");
+    SETTEXT("lint/badFunc"       , "badFunctions");
+    SETTEXT("lint/goodNames"     , "goodNames");
+    SETTEXT("lint/badNames"      , "badNames");
+    SETINT ("lint/maxLineLength" , "maxLineLength");
+    SETINT ("lint/maxModLines"   , "maxModuleLenght");
+
+    SETTEXT("lint/checkModule"   , "moduleStyle");
+    SETTEXT("lint/checkConst"    , "constStyle");
+    SETTEXT("lint/checkClass"    , "classStyle");
+    SETTEXT("lint/checkFunc"     , "funcStyle");
+    SETTEXT("lint/checkMethod"   , "methodStyle");
+    SETTEXT("lint/checkAttr"     , "attrStyle");
+    SETTEXT("lint/checkArg"      , "argStyle");
+    SETTEXT("lint/checkVar"      , "varStyle");
+    SETTEXT("lint/checkInlineVar", "inlVarStyle");
+
+    SETINT ("lint/maxArgs"       , "maxArgs");
+    SETTEXT("lint/ignArgNames"   , "ignoreNames");
+    SETINT ("lint/maxLocals"     , "maxLocals");
+    SETINT ("lint/maxReturns"    , "maxReturns");
+    SETINT ("lint/maxBranchs"    , "maxBranchs");
+    SETINT ("lint/maxStats"      , "maxStats");
+    SETINT ("lint/maxParents"    , "maxParents");
+    SETINT ("lint/maxAttrs"      , "maxAttr");
+    SETINT ("lint/minPublic"     , "minPublic");
+    SETINT ("lint/maxPublic"     , "maxPublic");
+
+    SETINT ("lint/style"         , "useStyle");
+
+    _settings->sync();
+    if (changed){
+        _pythonCode->init(interpretExec(), path(), mainScript(), _settings->fileName());
+        emit lintChanged();
+    }
+}
+
 }

src/Project/ProjectFile.h

 #ifndef _PROJECT_H_
 #define _PROJECT_H_
+#include <QMap>
 #include "IProject.h"
 
 class QSettings;
     void setInterpretName(const QString& name);
     virtual QString guiName();
     void setGuiName(const QString& name);
+
+    QMap<QString, QVariant> codeCheck();
+    void setCodeCheck(const QMap<QString, QVariant>& check);
 public slots:
     virtual void openFile(const QString& fileName, int offset = 0);
 private:

src/Project/Properties/CodeCheck.cpp

+#include "CodeCheck.h"
+#include "ui_CodeCheck.h"
+#include "ProjectFile.h"
+
+namespace Project {
+
+CodeCheck::CodeCheck(QWidget* parent):
+    QWidget(parent),
+    _ui(new Ui::CodeCheck),
+    _project(NULL)
+{
+    _ui->setupUi(this);
+}
+
+CodeCheck::~CodeCheck()
+{
+    delete _ui;
+}
+
+void CodeCheck::setProject(ProjectFile* project)
+{
+    _project = project;
+    initBasic();
+}
+
+void CodeCheck::initBasic()
+{
+    QMap<QString, QVariant> check = _project->codeCheck();
+    _ui->dummyVars->setText(check["dummyVars"].toString());
+    _ui->badFunctions->setText(check["badFunctions"].toString());
+    _ui->goodNames->setText(check["goodNames"].toString());
+    _ui->badNames->setText(check["badNames"].toString());
+    _ui->maxLineLength->setValue(check["maxLineLength"].toInt());
+    _ui->maxModuleLenght->setValue(check["maxModuleLenght"].toInt());
+
+    _ui->moduleStyle->setText(check["moduleStyle"].toString());
+    _ui->constStyle->setText(check["constStyle"].toString());
+    _ui->classStyle->setText(check["classStyle"].toString());
+    _ui->funcStyle->setText(check["funcStyle"].toString());
+    _ui->methodStyle->setText(check["methodStyle"].toString());
+    _ui->attrStyle->setText(check["attrStyle"].toString());
+    _ui->argStyle->setText(check["argStyle"].toString());
+    _ui->varStyle->setText(check["varStyle"].toString());
+    _ui->inlVarStyle->setText(check["inlVarStyle"].toString());
+
+    _ui->maxArgs->setValue(check["maxArgs"].toInt());
+    _ui->ignoreNames->setText(check["ignoreNames"].toString());
+    _ui->maxLocals->setValue(check["maxLocals"].toInt());
+    _ui->maxReturns->setValue(check["maxReturns"].toInt());
+    _ui->maxBranchs->setValue(check["maxBranchs"].toInt());
+    _ui->maxStats->setValue(check["maxStats"].toInt());
+    _ui->maxParents->setValue(check["maxParents"].toInt());
+    _ui->maxAttr->setValue(check["maxAttr"].toInt());
+    _ui->minPublic->setValue(check["minPublic"].toInt());
+    _ui->maxPublic->setValue(check["maxPublic"].toInt());
+
+    switch(check["useStyle"].toInt()){
+    case 1: _ui->camelStyle->setChecked(true); _ui->styleGroup->setEnabled(false); break;
+    case 2: _ui->customStyle->setChecked(true); _ui->styleGroup->setEnabled(true); break;
+    default: _ui->underscoreStyle->setChecked(true); _ui->styleGroup->setEnabled(false); break;
+    }
+
+    connect(_ui->camelStyle, SIGNAL(toggled(bool)), SLOT(onCamelToggled(bool)));
+    connect(_ui->underscoreStyle, SIGNAL(toggled(bool)), SLOT(onUnderscoreToggled(bool)));
+    connect(_ui->customStyle, SIGNAL(toggled(bool)), SLOT(onCustomToggled(bool)));
+}
+
+void CodeCheck::onCamelToggled(bool toggled)
+{
+    if (!toggled)
+        return;
+
+    _ui->moduleStyle->setText("(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$");
+    _ui->constStyle->setText("(([A-Z_][A-Z0-9_]*)|(__.*__))$");
+    _ui->classStyle->setText("[A-Z_][a-zA-Z0-9]+$");
+    _ui->funcStyle->setText("[a-z_][a-zA-Z0-9_]{2,30}$");
+    _ui->methodStyle->setText("[a-z_][a-zA-Z0-9_]{2,30}$");
+    _ui->attrStyle->setText("[a-z_][a-zA-Z0-9_]{2,30}$");
+    _ui->argStyle->setText("[a-z_][a-zA-Z0-9_]{2,30}$");
+    _ui->varStyle->setText("[a-z_][a-zA-Z0-9_]{2,30}$");
+    _ui->inlVarStyle->setText("[A-Za-z_][A-Za-z0-9_]*$");
+
+    _ui->styleGroup->setEnabled(false);
+}
+
+void CodeCheck::onCustomToggled(bool toggled)
+{
+    if (!toggled)
+        return;
+
+    QMap<QString, QVariant> check = _project->codeCheck();
+    _ui->moduleStyle->setText(check["moduleStyle"].toString());
+    _ui->constStyle->setText(check["constStyle"].toString());
+    _ui->classStyle->setText(check["classStyle"].toString());
+    _ui->funcStyle->setText(check["funcStyle"].toString());
+    _ui->methodStyle->setText(check["methodStyle"].toString());
+    _ui->attrStyle->setText(check["attrStyle"].toString());
+    _ui->argStyle->setText(check["argStyle"].toString());
+    _ui->varStyle->setText(check["varStyle"].toString());
+    _ui->inlVarStyle->setText(check["inlVarStyle"].toString());
+
+    _ui->styleGroup->setEnabled(true);
+}
+
+void CodeCheck::onUnderscoreToggled(bool toggled)
+{
+    if (!toggled)
+        return;
+
+    _ui->moduleStyle->setText("(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$");
+    _ui->constStyle->setText("(([A-Z_][A-Z0-9_]*)|(__.*__))$");
+    _ui->classStyle->setText("[A-Z_][a-zA-Z0-9]+$");
+    _ui->funcStyle->setText("[a-z_][a-z0-9_]{2,30}$");
+    _ui->methodStyle->setText("[a-z_][a-z0-9_]{2,30}$");
+    _ui->attrStyle->setText("[a-z_][a-z0-9_]{2,30}$");
+    _ui->argStyle->setText("[a-z_][a-z0-9_]{2,30}$");
+    _ui->varStyle->setText("[a-z_][a-z0-9_]{2,30}$");
+    _ui->inlVarStyle->setText("[A-Za-z_][A-Za-z0-9_]*$");
+
+    _ui->styleGroup->setEnabled(false);
+}
+
+void CodeCheck::save()
+{
+    QMap<QString, QVariant> check = _project->codeCheck();
+
+    check["dummyVars"]       = _ui->dummyVars->text();
+    check["badFunctions"]    = _ui->badFunctions->text();
+    check["goodNames"]       = _ui->goodNames->text();
+    check["badNames"]        = _ui->badNames->text();
+    check["maxLineLength"]   = _ui->maxLineLength->value();
+    check["maxModuleLenght"] = _ui->maxModuleLenght->value();
+
+
+    check["moduleStyle"]     = _ui->moduleStyle->text();
+    check["constStyle"]      = _ui->constStyle->text();
+    check["classStyle"]      = _ui->classStyle->text();
+    check["funcStyle"]       = _ui->funcStyle->text();
+    check["methodStyle"]     = _ui->methodStyle->text();
+    check["attrStyle"]       = _ui->attrStyle->text();
+    check["argStyle"]        = _ui->argStyle->text();
+    check["varStyle"]        = _ui->varStyle->text();
+    check["inlVarStyle"]     = _ui->inlVarStyle->text();
+
+    check["maxArgs"]         = _ui->maxArgs->value();
+    check["ignoreNames"]     = _ui->ignoreNames->text();
+    check["maxLocals"]       = _ui->maxLocals->value();
+    check["maxReturns"]      = _ui->maxReturns->value();
+    check["maxBranchs"]      = _ui->maxBranchs->value();
+    check["maxStats"]        = _ui->maxStats->value();
+    check["maxParents"]      = _ui->maxParents->value();
+    check["maxAttr"]         = _ui->maxAttr->value();
+    check["minPublic"]       = _ui->minPublic->value();
+    check["maxPublic"]       = _ui->maxPublic->value();
+
+    if (_ui->camelStyle->isChecked())
+        check["useStyle"] = 1;
+    else if (_ui->underscoreStyle->isChecked())
+        check["useStyle"] = 0;
+    else
+        check["useStyle"] = 2;
+
+    _project->setCodeCheck(check);
+}
+
+}

src/Project/Properties/CodeCheck.h

+#ifndef _CODECHECK_H_
+#define _CODECHECK_H_
+#include <QWidget>
+
+namespace Ui { class CodeCheck; }
+
+namespace Project {
+class ProjectFile;
+
+class CodeCheck: public QWidget
+{
+    Q_OBJECT
+public:
+    CodeCheck(QWidget* parent = NULL);
+    virtual ~CodeCheck();
+
+    void setProject(ProjectFile* project);
+    void save();
+private:
+    void initBasic();
+private slots:
+    void onCamelToggled(bool);
+    void onCustomToggled(bool);
+    void onUnderscoreToggled(bool);
+private:
+    Ui::CodeCheck *_ui;
+    ProjectFile * _project;
+};
+
+}
+
+#endif

src/Project/Properties/CodeCheck.ui

+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>CodeCheck</class>
+ <widget class="QWidget" name="CodeCheck">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>512</width>
+    <height>486</height>
+   </rect>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QTabWidget" name="tabWidget">
+     <property name="currentIndex">
+      <number>1</number>
+     </property>
+     <widget class="QWidget" name="tab">
+      <attribute name="title">
+       <string>Basic</string>
+      </attribute>
+      <layout class="QVBoxLayout" name="verticalLayout_2">
+       <item>
+        <layout class="QFormLayout" name="formLayout">
+         <item row="0" column="0">
+          <widget class="QLabel" name="label">
+           <property name="text">
+            <string>Dummy variables:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="0">
+          <widget class="QLabel" name="label_2">
+           <property name="text">
+            <string>Bad functions:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="2" column="0">
+          <widget class="QLabel" name="label_3">
+           <property name="text">
+            <string>Good names:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="3" column="0">
+          <widget class="QLabel" name="label_4">
+           <property name="text">
+            <string>Bad names:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="4" column="0">
+          <widget class="QLabel" name="label_5">
+           <property name="text">
+            <string>Max line length:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="5" column="0">
+          <widget class="QLabel" name="label_6">
+           <property name="text">
+            <string>Max module lines:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="1">
+          <widget class="QLineEdit" name="dummyVars"/>
+         </item>
+         <item row="1" column="1">
+          <widget class="QLineEdit" name="badFunctions"/>
+         </item>
+         <item row="2" column="1">
+          <widget class="QLineEdit" name="goodNames"/>
+         </item>
+         <item row="3" column="1">
+          <widget class="QLineEdit" name="badNames"/>
+         </item>
+         <item row="4" column="1">
+          <widget class="QSpinBox" name="maxLineLength">
+           <property name="maximum">
+            <number>999999</number>
+           </property>
+          </widget>
+         </item>
+         <item row="5" column="1">
+          <widget class="QSpinBox" name="maxModuleLenght">
+           <property name="maximum">
+            <number>999999</number>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="tab_2">
+      <attribute name="title">
+       <string>Style</string>
+      </attribute>
+      <layout class="QVBoxLayout" name="verticalLayout_3">
+       <item>
+        <widget class="QRadioButton" name="camelStyle">
+         <property name="text">
+          <string>Camel case</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QRadioButton" name="underscoreStyle">
+         <property name="text">
+          <string>Underscore style</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QRadioButton" name="customStyle">
+         <property name="text">
+          <string>Custom style</string>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <widget class="QGroupBox" name="styleGroup">
+         <property name="title">
+          <string>Style rules</string>
+         </property>
+         <layout class="QVBoxLayout" name="verticalLayout_4">
+          <item>
+           <layout class="QFormLayout" name="formLayout_2">
+            <item row="0" column="0">
+             <widget class="QLabel" name="label_7">
+              <property name="text">
+               <string>Module:</string>
+              </property>
+             </widget>
+            </item>
+            <item row="1" column="0">
+             <widget class="QLabel" name="label_8">
+              <property name="text">
+               <string>Const:</string>
+              </property>
+             </widget>
+            </item>
+            <item row="2" column="0">
+             <widget class="QLabel" name="label_9">
+              <property name="text">
+               <string>Class:</string>
+              </property>
+             </widget>
+            </item>
+            <item row="3" column="0">
+             <widget class="QLabel" name="label_10">
+              <property name="text">
+               <string>Function:</string>
+              </property>
+             </widget>
+            </item>
+            <item row="4" column="0">
+             <widget class="QLabel" name="label_11">
+              <property name="text">
+               <string>Method:</string>
+              </property>
+             </widget>
+            </item>
+            <item row="5" column="0">
+             <widget class="QLabel" name="label_12">
+              <property name="text">
+               <string>Attribute:</string>
+              </property>
+             </widget>
+            </item>
+            <item row="6" column="0">
+             <widget class="QLabel" name="label_13">
+              <property name="text">
+               <string>Argument:</string>
+              </property>
+             </widget>
+            </item>
+            <item row="7" column="0">
+             <widget class="QLabel" name="label_14">
+              <property name="text">
+               <string>Variable:</string>
+              </property>
+             </widget>
+            </item>
+            <item row="8" column="0">
+             <widget class="QLabel" name="label_15">
+              <property name="text">
+               <string>Inline variable:</string>
+              </property>
+             </widget>
+            </item>
+            <item row="0" column="1">
+             <widget class="QLineEdit" name="moduleStyle"/>
+            </item>
+            <item row="1" column="1">
+             <widget class="QLineEdit" name="constStyle"/>
+            </item>
+            <item row="2" column="1">
+             <widget class="QLineEdit" name="classStyle"/>
+            </item>
+            <item row="3" column="1">
+             <widget class="QLineEdit" name="funcStyle"/>
+            </item>
+            <item row="4" column="1">
+             <widget class="QLineEdit" name="methodStyle"/>
+            </item>
+            <item row="5" column="1">
+             <widget class="QLineEdit" name="attrStyle"/>
+            </item>
+            <item row="6" column="1">
+             <widget class="QLineEdit" name="argStyle"/>
+            </item>
+            <item row="7" column="1">
+             <widget class="QLineEdit" name="varStyle"/>
+            </item>
+            <item row="8" column="1">
+             <widget class="QLineEdit" name="inlVarStyle"/>
+            </item>
+           </layout>
+          </item>
+         </layout>
+        </widget>
+       </item>
+      </layout>
+     </widget>
+     <widget class="QWidget" name="tab_3">
+      <attribute name="title">
+       <string>Design</string>
+      </attribute>
+      <layout class="QVBoxLayout" name="verticalLayout_5">
+       <item>
+        <layout class="QFormLayout" name="formLayout_3">
+         <property name="fieldGrowthPolicy">
+          <enum>QFormLayout::ExpandingFieldsGrow</enum>
+         </property>
+         <item row="0" column="0">
+          <widget class="QLabel" name="label_16">
+           <property name="text">
+            <string>Max args:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="1">
+          <widget class="QSpinBox" name="maxArgs">
+           <property name="maximum">
+            <number>99999</number>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="0">
+          <widget class="QLabel" name="label_17">
+           <property name="text">
+            <string>Ignored argument names:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="1">
+          <widget class="QLineEdit" name="ignoreNames"/>
+         </item>
+         <item row="2" column="0">
+          <widget class="QLabel" name="label_18">
+           <property name="text">
+            <string>Max locals:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="2" column="1">
+          <widget class="QSpinBox" name="maxLocals">
+           <property name="maximum">
+            <number>99999</number>
+           </property>
+          </widget>
+         </item>
+         <item row="3" column="0">
+          <widget class="QLabel" name="label_19">
+           <property name="text">
+            <string>Max returns:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="3" column="1">
+          <widget class="QSpinBox" name="maxReturns">
+           <property name="maximum">
+            <number>99999</number>
+           </property>
+          </widget>
+         </item>
+         <item row="4" column="0">
+          <widget class="QLabel" name="label_20">
+           <property name="text">
+            <string>Max branchs:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="4" column="1">
+          <widget class="QSpinBox" name="maxBranchs">
+           <property name="maximum">
+            <number>99999</number>
+           </property>
+          </widget>
+         </item>
+         <item row="5" column="0">
+          <widget class="QLabel" name="label_21">
+           <property name="text">
+            <string>Max statements:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="5" column="1">
+          <widget class="QSpinBox" name="maxStats">
+           <property name="maximum">
+            <number>99999</number>
+           </property>
+          </widget>
+         </item>
+         <item row="6" column="0">
+          <widget class="QLabel" name="label_22">
+           <property name="text">
+            <string>Max parents:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="6" column="1">
+          <widget class="QSpinBox" name="maxParents">
+           <property name="maximum">
+            <number>99999</number>
+           </property>
+          </widget>
+         </item>
+         <item row="7" column="0">
+          <widget class="QLabel" name="label_23">
+           <property name="text">
+            <string>Max attributes:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="7" column="1">
+          <widget class="QSpinBox" name="maxAttr">
+           <property name="maximum">
+            <number>99999</number>
+           </property>
+          </widget>
+         </item>
+         <item row="8" column="0">
+          <widget class="QLabel" name="label_24">
+           <property name="text">
+            <string>Min public methods:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="8" column="1">
+          <widget class="QSpinBox" name="minPublic">
+           <property name="maximum">
+            <number>99999</number>
+           </property>
+          </widget>
+         </item>
+         <item row="9" column="0">
+          <widget class="QLabel" name="label_25">
+           <property name="text">
+            <string>Max public methods:</string>
+           </property>
+          </widget>
+         </item>
+         <item row="9" column="1">
+          <widget class="QSpinBox" name="maxPublic">
+           <property name="maximum">
+            <number>99999</number>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </item>
+      </layout>
+     </widget>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

src/Project/Properties/ProjectProperties.cpp

     ui->setupUi(this);
 
     ui->project->setProject(project);
+    ui->code->setProject(project);
 
     connect(ui->buttonBox, SIGNAL(accepted()), SLOT(onAccept()));
     connect(ui->buttonBox, SIGNAL(rejected()), SLOT(reject()));
 void ProjectProperties::onAccept()
 {
     ui->project->save();
+    ui->code->save();
     accept();
 }
 

src/Project/Properties/ProjectProperties.ui

    <rect>
     <x>0</x>
     <y>0</y>
-    <width>674</width>
-    <height>552</height>
+    <width>672</width>
+    <height>550</height>
    </rect>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
        <string>Project</string>
       </attribute>
      </widget>
-     <widget class="QWidget" name="code">
+     <widget class="Project::CodeCheck" name="code">
       <attribute name="title">
        <string>Code check</string>
       </attribute>
    <header>Properties/General.h</header>
    <container>1</container>
   </customwidget>
+  <customwidget>
+   <class>Project::CodeCheck</class>
+   <extends>QWidget</extends>
+   <header>Properties/CodeCheck.h</header>
+   <container>1</container>
+  </customwidget>
  </customwidgets>
  <resources/>
  <connections/>

src/PythonCode/IPythonCode.h

     virtual void init(const QString& interpret, const QString& projectPath, const QString& mainScript, const QString& projectFile) = 0;
     virtual void codeComplit(const QString& fileName, const QString& cnt, int pos) = 0;
     virtual void errorList(const QString& fileName, const QString & content) = 0;
+    virtual void close() = 0;
 signals:
     void errors(const QString& fileName, const QList<ErrorItem>& items);
     void complitition(const QString& fileName, int pos, const QString& word, const QList<Completition>& items);

src/PythonCode/PythonCode.cpp

 
 PythonCode::~PythonCode()
 {
-    closeProc();
+    close();
 }
 
 
     if (!QFile::exists(path))
         path = "/usr/share/pynoto/python3/rope.py";
 
-    closeProc();
+    close();
     qDebug() << path << interpret;
 
     _proc = new QProcess(this);
 }
 
 
-void PythonCode::closeProc()
+void PythonCode::close()
 {
     if (_soc){
         _soc->close();
         _proc->waitForFinished(1000);
         delete _proc;
         _proc = NULL;
+        qDebug() << "python closed";
     }
 }
 

src/PythonCode/PythonCode.h

     virtual void init(const QString& interpret, const QString& projectPath, const QString& mainScript, const QString& projectFile);
     virtual void codeComplit(const QString& fileName, const QString& cnt, int pos);
     virtual void errorList(const QString& fileName, const QString & content);
+    virtual void close();
 private:
-    void closeProc();
     void sendSyncRequest(const QString& req);
     void sendAsyncRequest(const QString& req);
     QString createRequest(const QString& name, const QVariantList& params);

src/PythonEditor/PythonCompliter.cpp

 {
     _project = Aux::plugin<Project::IProjectPlugin*>("project")->project();
     connect(_project, SIGNAL(interpretChanged()), SLOT(initPyCode()));
+    connect(_project, SIGNAL(lintChanged()), SLOT(checkErrors()));
     _list = new ComplititionList(_editor, _editor->viewport());
     initPyCode();
 }

src/PythonEditor/PythonCompliter.h

     PythonCompliter(PythonEditorWidget * parent = NULL);
     void showComplit(int pos);
     void hide();
-    void checkErrors();
     bool isVisible();
 public slots:
     void onErrors(const QString& fileName, const QList<ErrorItem>& items);
     void onComplit(const QString& fileName, int pos, const QString& word, const QList<Completition>& items);
     void initPyCode();
+    void checkErrors();
 private:
     PythonEditorWidget * _editor;
     PythonCode::IPythonCode *_python;