florianschanda / miss_hit

MATLAB Independent, Small & Safe, High Integrity Tools - code formatter and more
GNU General Public License v3.0
158 stars 21 forks source link

Does it support calls in Python code? #285

Closed 17Reset closed 1 month ago

florianschanda commented 1 month ago

I do not understand this ticket. Can you please elaborate on the question?

17Reset commented 1 month ago

Called as an API in Python code, not cli mode

florianschanda commented 1 month ago

Of course. Please have a look at https://github.com/florianschanda/miss_hit/blob/master/miss_hit_core/mh_metric.py#L1166 how to create a new backend.

You can also directly instantiate a parser but it's a bit more tricky. You can have a look at https://github.com/florianschanda/miss_hit/blob/master/miss_hit_core/command_line.py#L262 what is necessary.

You can skip all the config mechanism, and just create an instance of MATLAB_Parser (see https://github.com/florianschanda/miss_hit/blob/master/miss_hit_core/m_parser.py#L89)

The smallest example of this is the debug script: https://github.com/florianschanda/miss_hit/blob/master/mh_debug_parser

HTH