Comments (2)
Hi @langston-barrett ,
Thanks for raising! bellybutton
relies on the first characters of the expr
being //
, to know to parse the value as an XPath expression. I will not close this ticket, since you (rightly) point out the annoyance of not being able to use the standard YAML multi-line syntax, however, I think you should be able to instead do:
filter_by:
description: Use SQLAlchemy's filter_by for concision
expr:
//Call[ ./func/Attribute[ @attr='filter'
and ./value/Call[./func/Attribute[@attr='query']
and ./args[count(child::*) = 1]]
]
and ./args[count(child::*) = 1]
and ./args/Compare[ ./ops/Eq
and ./left/Attribute[ @attr != 'attributes'
and ./value/Name
]
]
]
example: |
session.query(Model).filter(Model.attr == baz)
instead: |
session.query(Model).filter_by(attr = baz)
settings: *all_files
and have it work (or, at least, this is how I typically format my .bellybutton.yml
files). Please let me know if this helps!
- Chase
from bellybutton.
@hchasestevens Thanks for the quick reply! That works perfectly. Feel free to keep open if you feel like supporting YAML multi-line string syntax, but I'm satisfied as long as I can write the rules readably.
from bellybutton.
Related Issues (14)
- Crash when using regular expressions HOT 2
- Feature suggestion: Ignore only given set of rules HOT 2
- Feature suggestion: Run on files given from terminal, not on files specified in configuration file HOT 7
- Feature suggestion: Path for configuration file given from terminal HOT 2
- astpath recent upgrade breaks `bellybutton lint` HOT 4
- pyyaml update breaks bellybuton lint HOT 2
- Bellybutton breaks on non-ascii characters in source
- Exclude doesn't exclude HOT 4
- --modified-only flag walks over all file types in diff HOT 2
- How To Design a Rule For This Scenario
- Programmatically usage
- Support for Python 3.7+ HOT 1
- Support multiple config files (from cli)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bellybutton.