Another analysis approach can import some information into a database.
@initialize:python@@@importsqlalchemy,syssys.stderr.write("\n".join(["Using SQLAlchemy version:",sqlalchemy.__version__]))sys.stderr.write("\n")fromsqlalchemyimportcreate_engine,Column,Integer,Stringengine=create_engine("sqlite:///:memory:",echo=False)fromsqlalchemy.ext.declarativeimportdeclarative_basebase=declarative_base()classposition(base):__tablename__="positions"source_file=Column(String,primary_key=True)line=Column(Integer,primary_key=True)column=Column(Integer,primary_key=True)pattern=Column(String)fromsqlalchemy.ormimportsessionmakerconfigured_session=sessionmaker(bind=engine)session=configured_session()base.metadata.create_all(engine)defstore_positions(text,places):"""Add source code positions to an internal table."""forplaceinplaces:entry=position(source_file=place.file,line=place.line,column=int(place.column)+1,pattern=text)session.add(entry)@filter@constanttext;positionpos;@@Token::Match(...,text@pos,...)@script:pythoncollection@text<<filter.text;places<<filter.pos;@@store_positions(text,places)@finalize:python@@@session.commit()fromsqlalchemyimportfuncentries=session.query(func.count("*")).select_from(position).scalar()ifentries>0:delimiter="|"sys.stdout.write(delimiter.join(["pattern","incidence"]))sys.stdout.write("\r\n")forpattern, \
countinsession.query(position.pattern,func.count("*")) \
.group_by(position.pattern).all():sys.stdout.write(delimiter.join([pattern,str(count)]))sys.stdout.write("\r\n")else:sys.stderr.write("No result for this analysis!\n")
I got into the mood to repeat this analysis approach for the tool version “2.9.3”.
Thus I determined by my SmPL script “list_often_used_match_expressions.cocci” that 197 patterns were passed more than once to the member function “Token::Match”.
🔮 Will such incidence statistics trigger further software evolution?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This approach shows data processing possibilities which are supported by specific software development tools.
It demonstrates another try to extract useful facts from changing source files.
Will the semantic patch language (Coccinelle software) be used by any more developers (besides me here) for the concrete clarification of implementation details?
Would you find it interesting to determine where a Cppcheck search pattern is applied more than once?
How much do variations matter in these search patterns?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The source files of this evolving software can be analysed also by the means of the semantic patch language to some degree.
The following script can show places where match expressions are passed so that they will eventually be reconsidered.
Another analysis approach can import some information into a database.
So it can be determined that 1127 patterns are passed to a function for evaluation so far.
Do you get any ideas for further software evolution around such data processing possibilities?
I got into the mood to repeat this analysis approach for the tool version “2.9.3”.
Thus I determined by my SmPL script “list_often_used_match_expressions.cocci” that 197 patterns were passed more than once to the member function “Token::Match”.
🔮 Will such incidence statistics trigger further software evolution?
I do not see what value it has. It's like count number of character 'x' in the code... I do not see any use for that information.
This approach shows data processing possibilities which are supported by specific software development tools.
It demonstrates another try to extract useful facts from changing source files.
I am not against smpl.