Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create gobrafied debug files #540

Merged
merged 1 commit into from
Oct 6, 2022
Merged

Create gobrafied debug files #540

merged 1 commit into from
Oct 6, 2022

Conversation

ArquintL
Copy link
Member

@ArquintL ArquintL commented Oct 4, 2022

If unparse is enabled, .gobrafied files will be created with the gobrafied content of the input files.
This is useful to count the number of lines of specification in the following way:
LOC = lines of code of a .go file counted by the usual tools
LOS = lines of code of a .gobrafied file - LOC + hybrid lines

A hybrid line is a line that contains actual code and annotations. The following command can be used to count these hybrid lines:

awk 'fname != FILENAME { printf "%s: %s\n", fname, count; fname = FILENAME; count = 0 } /.*\/\*@.*@\*\/.*/ { count++; total++ } END { print total }' $(find . -name '*.go' -or -name '*.gobra')

Copy link
Contributor

@Felalolf Felalolf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think long term, Gobra should be able to just print statistics regarding LOC, LOS, etc.

@ArquintL
Copy link
Member Author

ArquintL commented Oct 4, 2022

That would indeed be very nice. Would you look at ‚ghostness‘ of statements & expressions together with their positional information to compute this or integrate similar metrics as we use externally today? For the latter one, a big question to me seems to be how we count .gobra files, i.e. as spec-only (& maybe even check this)

@ArquintL ArquintL merged commit 44fb812 into master Oct 6, 2022
@ArquintL ArquintL deleted the gobrafied-files branch October 6, 2022 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants