Coder Social home page Coder Social logo

pylint-playero-plugin's Introduction

pylint-playero-plugin

status Build Status Coverage Status

About

pylint-playero-plugin is a Pylint plugin for improving code analysis for when analysing code using Playero ERP.

Usage

Pylint

Ensure pylint-playero-plugin is installed and on your path, and then run pylint:

pylint --load-plugins Playero [..other options..]

Read the wiki for usage with SublimeText

Features

  • Prevents warnings and errors about Playero-generated attributes, classes, methods. (Now fully supported)
  • Xml record file parsing to get attributes of a table/class.
  • Py file parsing to get methods, functions and attributes of a class.
  • Inheritance is generated based on Playero's xml settings file.
  • built-in methods, functions and attributes accepted. (Now fully supported)
  • SuperClass generation.
  • NewRecord, NewReport, NewWindow generation.
  • Query parsing and checking for syntax

License

pylint-playero-plugin is available under the GPLv2 license.

Required

  • logilab-common==0.61.0
  • astroid==1.1.1
  • pylint-1.0.0

Required to check mysql syntax:

  • pyparsing-2.0.2
  • MySQL-python-1.2.5

pylint-playero-plugin's People

Contributors

ancho85 avatar

Watchers

James Cloos avatar  avatar  avatar

pylint-playero-plugin's Issues

Improve findPaths()

the search of paths is actually very difficult to understand. Must be refactored and divided in minor sub functions

refactor directory structure

create a pylint_playero directory and move everything inside it, leaving outside of this directory all those files not related with the plugin itself, as .gitignore, License and README.md
This will be done for properly use an import system based on pylint_playero namespace, which currently cannot be done due to the "-" in the plugin's folder name.
Take as reference pylint_django directory structure

speed up

takes a lot of time to finish. Even with the use of @cache.store as decorator there must be a way to speed things up. Check profile results.

classes are built based on xml files only

classes_transform calls findPaths, which locates in the "interface" directory only.
If not found, then no functionality is available.

Example: CreditLimitUpdate.py in extra/Flota/routines

Classes' attribute analysis fails when that attribute is assigned anywhere in the code

If an attribute is accessed only to be read, all is ok. But is that attribute is somehow written, an error happens in astroid: 'dict' has no attribute 'append'

from OpenOrange import *

ParentStock = SuperClass("Stock", "Record", __file__)
class Stock(ParentStock):

    pass


from StockSettings import StockSettings
ss = StockSettings.bring()
Stock.allowInvertedStockValues = ss.AllowInvertedStockValues #PROBLEM HERE

cannot import classes defined inside other classes (Row instances)

pylint init-hook includes all workspace paths defined in config/playero.cfg
In the same file is defined 2 classes. Invoice.py

from Invoice import Invoice #works
from Invoice import InvoiceItemRow #works
from InvoiceItemRow import InvoiceItemRow  #Does not work.

It also should work as last line is defined

Multiple level of inheritance are not inferred correctly

Enabling a higher level of inheritance causes that methods and attributes from given class not be correctly generated.
Example:

  <scriptdir level="4" path="extra/Flota" />
  <scriptdir level="5" path="extra/GasStation" />
  <scriptdir level="6" path="extra/GestionSensitive" />
from Invoice import Invoice
Invoice.bring(1)

Class 'Invoice' has no 'bring' member

build and parse exec statements

try to parse and build import statements:

exec("from %s import %s as theRecord" % (rows.Type, rows.Type))
exec("from %sWindow import %sWindow as theWindow" % (rows.Type, rows.Type))
ther = theRecord.bring(rows.SerNr)
if ther:
    window = theWindow()
    window.setRecord(ther)
    window.open() 

Also assignments statements:

exec("curRowValue = rec.%s[rownr]" % fieldname)
exec("rowObjList = rec.%s" % fieldname) 

build and parse Query objects

the built-in object Query and the primary attribute "sql" must be created and parsed in order to detect possible query syntax errors

Transaction's buildRecordModule throws AttributeError when pylinting

"AttributeError: 'int' object has no attribute 'statement'
On Transaction.py pylint process, buildRecordModule on

class Transaction(object):
    Origin = {}
    Origin["SalesOrder"] = 0 #LINE THROWING THE PROBLEM

Playero.py's plugin issue detected at buildRecordModule function:

module.locals.update([(attrs, {0:None}) for attrs in attributes if not attrs.startswith("_")])

Document classes and inheritance wouldn't build

Currently there are no way to guess the type of class, only by the xml file, so, when a document is being builded all the inheritance, methods and attributes are skipped.
Example: SAGEProcess branch

plugin should not apply to itself

When pylinting files inside "playero" workspace it's ok to use this plugin. But other files outside path's definition (playero.cfg) should be ignored and pylint them with basics only

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.