-
-
Notifications
You must be signed in to change notification settings - Fork 513
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 a documentation comment linter that is compatible with DartDoc #1479
Comments
Congratulations on making your first Issue! 🎊 If you haven't already, check out our Contributing Guidelines and Issue Reporting Guidelines to ensure that you are following our guidelines for contributing and making issues. |
@anwersayeed @palisadoes I am interested in working on this issue. I am not very proficient with linters and docs but I am willing to learn. |
Are you proficient with python? One approach would be to write a python script that reads files and makes sure there is an comment block that includes:
for each method class and function. The comment block would need to also need to be located where DartDoc can process it. The documentationcheck.py file could then be updated to flag all files that don't comply. It currently just checks modified files in the PR to see whether there is at least one comment line. It does nothing more. This is insufficient. With this approach we can slowly get the documentation improved. This is the minimum requirement. Still interested? It requires an understanding of Dart and python or a similar scripting language. You can also try to research other linting solutions. |
I do know python and have written quite some scripts for daily use. So is it like that the script will run on each file, parse it and check whether the
with string parsing techniques ? |
Yes. It would need to report:
It would also need to:
User python's argparse module to differentiate between filenames or the directories. The script would need to show these results after processing all the data presented, not just after the first file is analyzed. Also, ensure you:
Black and pylint could also be added to our GitHub actions to improve the quality of our python helper scripts. The next issue to be created would be to do the same Google style analysis on our python scripts as an additional GitHub action. This would be useful for all our repositories. Please take the time to do a good job. This is an important thing to fix. |
For now I am looking at custom linting in Flutter and will try to make one from scratch if I feel it can work. |
@palisadoes @anwersayeed I wanted to ask what is our target for documentation ? Is it enough if public classes and their methods, attributes etc are documented ? Also, I am thinking that we would run this script after all the current tests finish so that the code will be syntactically correct and formatted and so extracting information while parsing will be straightforward. |
@palisadoes @anwersayeed I have found this lint option that asks for documentation for 'all public classes and their members'. Will it do ? |
|
|
|
@palisadoes what I am saying is that there already exists a lint rule in Flutter which when turned on, will
I am asking is will this much of documentation enforcement do ? Or we need to strictly check for documentation of private fields too ? |
What you showed only checks for the existence comments in the right location. It doesn't check for the content of the comments.
|
@palisadoes Hmm. I have thought of two possibilites.
I am currently working on the 1st option and will let you know about the progress. |
@literalEval Please remember the aim is to enforce compliance as a GitHub action. |
Hmm. I'll try to make a basic working prototype and update in 2-3 days. This issue will obviously take long to complete :) |
@palisadoes I think I have got what we needed.
Looking at the problem again -
So I came up with a solution for problem 1 -
For the modified linter gives below errors. Now it checks for documentation for ALL the fields. The only problem that remains is that it will also ask for documentation of class constructors etc. but I am sure I can further modify it to not do so. Is this good progress and should I continue in the same direction ? As I think there can't be any better idea than using the official linter itself. Please share your review and also any suggestions if you have. Edits:
|
It's good to see progress on this |
@TheHazeEffect , @Sagar2366, @noman2002 what do you think about this issue and the protected solution? |
Also, is this an exhaustive list of what we need ? |
This is not practical. Including a complete linter in the code base will add bloat that will have to maintain. Surely there must be a simple way to:
This should not be hard. You are not giving this enough thought. |
@palisadoes And how about I create a plugin (this modified linter) and for talawa we only refer to that plugin instead of adding the whole thing to the codebase ? That will be highly extensible as maybe in the future we need some other custom styling to our files. We will easily implement them with this method. There is also a Sure it can be done using string parsing with some python script but using a real linter is the most fail safe solution. But still, if everyone finds the python script idea better, I'll try to write a python script. |
For tiny functions, yes. But most functions are more complex. Remember, the reason for having this requirement is that we will be automatically extracting this data with DartDoc and adding it the Talawa website so that people can understand what all code does without having to examine it. In other words it improve our reference materials. |
That I totally understand @palisadoes. I have other ideas but maybe we can discuss them when this is merged, as version-2 of this implementation :) |
Can the void return doc be like |
Yes, I was thinking python which uses "none" |
Sorry @palisadoes I asked two questions at once and can't understand which one you agreed on :) |
Yes.
|
Like the 2nd point ? |
OR it should be
? |
Let's leave that decision up to the coder. As long as they do the documentation we'll be much better off than we are today. |
Okay. I'm going with the 2nd option for now. |
Hey @literalEval, I want to confirm that the HTML code will be generated smoothly with the linter.
|
|
@evasharma12 will do. |
Hope I answered all of your queries. Thanks. |
@tasneemkoushar can you answer my queries on Slack ? You are the possible mentor of the idea I wanted to work on for GSoC period. Thanks. |
Sure, Write me with all your queries on slack, I will get back to you as soon as I get time. |
We recently implemented automatic updating of the docs.talawa.io with descriptions extracted from the comments in the Talawa code base. This creates a wide range of HTML pages that explain the methods, functions and classes present in each file.
There are limitations with this approach.
There are many ways to approach this, but there are some general standards that are being accepted. For example there is the simple python pydocstyle linter that ensures basic compliance and the presence of comments immediately below each class, method and function declaration. This is insufficient.
Google has taken this one step further. In their python guide they explain that every method, class and function should have a description, definitions of the arguments and definitions of the results.
The TSDoc project attempts to do the same with
Typescript
, and have created a linter to help enforce compliance.We want to maintain the quality of our documentation by identifying a linter which has a way of creating HTML documentation.
Research a method to enforce documentation compliance for dart comments.
Documentation should include:
Note
Describe the solution you'd like
Describe alternatives you've considered
The text was updated successfully, but these errors were encountered: