From: Ishani <chugh.ishani@research.iiit.ac.in>
To: Lars Kurth <lars.kurth.xen@gmail.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
cardoe <cardoe@cardoe.com>,
Andrew Cooper <andrew.cooper3@citrix.com>
Subject: Re: [Outreachy] Interested in contribution: Code Standards Checking using clang-format
Date: Tue, 11 Apr 2017 16:51:54 +0530 (IST) [thread overview]
Message-ID: <214333585.4595284.1491909714711.JavaMail.zimbra@research.iiit.ac.in> (raw)
In-Reply-To: <3C41104B-D931-455F-BF00-819371158661@gmail.com>
Hello,
I have created a clang-format file for specifications of format for Xen hypervisor and incorporated all of the support which present clang-format could provide. I have seen all the options provided by clang-format and have some discrepancies regarding some of format specifications which are not provided in the doc but is followed. I will commit the code and provide you with full report by today.
>4: a small script that checks that .clang-format works correctly on these pieces of code
>For 4, you probably want to run clang-format with -output-replacements-xml on the files in 1 >- 3 and then do some grep magic to see whether it does the right thing.
Can you elaborate on this a bit. What is the expected end product?
Meanwhile, I have resumed on writing the proposal. I somehow missed previous comments. Please have a look at it.
https://docs.google.com/document/d/10NJn-QvO1TvyJJJGE2PD6FtElYCT3neBAffIqeWHdiE/edit?usp=sharing
Regards,
Ishani
----- Original Message -----
From: "Lars Kurth" <lars.kurth.xen@gmail.com>
To: "Ishani" <chugh.ishani@research.iiit.ac.in>
Cc: "cardoe" <cardoe@cardoe.com>, "xen-devel" <xen-devel@lists.xenproject.org>, "Andrew Cooper" <andrew.cooper3@citrix.com>
Sent: Monday, April 3, 2017 9:52:38 PM
Subject: Re: [Xen-devel] [Outreachy] Interested in contribution: Code Standards Checking using clang-format
Hi Ishani,
> On 3 Apr 2017, at 13:01, Ishani <chugh.ishani@research.iiit.ac.in> wrote:
>
> Thanks for the reply. I started with looking into format of Xen Hypervisor files and creating a clang format file for the same. However, given the present implementation of clang-format, it is not possible to incorporate fine-grained custom coding format requirements. For example, although clang-format provides a custom brace wrapping format specification, it is still not sufficient to incorporate the do while loop exception for braces in Xen Hypervisor format.
OK, this makes this project a lot harder. I don't think we are particularly tied to clang-format.
> The implementations is presently on higher layers of abstraction and needs to be fine grained to allow for different types of loops as well. I figured that there are two ways of doing it, First , by creating a wrapper over clang-format and using regexes to find appropriate partitions of code to follow different format styles.
> However, this will be rather cumbersome with multiple heuristics and we will lose the advantage of clang-format tool using the inbuilt parser.
Indeed.
> Second way is to extend the functionality of clang-format. I have experience working with compilers. Going through the code of clang it seems possible to include kw_do token for do while loop as a functionality for braces wrapping( although it would require a very thorough reading through the codebase first).
One of the objectives behind using clang was that we wanted to be able to use a compiler front-end that has a plug-in model or a library which allows access to the AST. Clang-format appeared to fit the bill.
> At present, I am working on creating a clang format file supporting subset of coding formats for Xen Hypervisor.
I think that would fit with what I suggested.
> Can you provide me with some more insight into the project?
There are really two objectives:
A) A tool which can be run over submissions by new contributors. Right now, adherence to coding standards has to be manually checked. Having a tool which lists coding standard violations in a git-patch or in the files a patch touches would allow contributors to run the tool before submitting the code. Ideally, it could be run over a patch, but that may be harder than running it over the files the patch touches. In any case, it would improve the work-flow.
B) Be able to run the tool on the entire code base.
We also want to make this as easy to maintain in future as possible, which is why we originally suggested clang-format. It might in fact be easier or cleaner to use LibTooling rather than clang-format for this as base-line and use clang-format as an inspiration (looking at the source of clang-format, there does not seem to be that much). Keeping as close as possibly to the clang-format config file. The downside is that we would have to maintain such a tool in the long-run (but then we would have to do the same if we used a stand-alone tool using script hackery). I don't think either Doug, Andy, or me could give you concrete advice on what the best way forward is here without further discussion though.
> clang-format formats the tool to specified format. However, there are many standards which include a particular format for a variable name. It is not feasible for a tool to automatically change the name of variable according to given standards because of possible breaking build of the code.
That is not the intention: it is definitely not desirable to do that kind of refactoring automatically.
> As a part of the project, are we required to create an auto-formatter or something like pylint which suggests the necessary changes and gives an overall score, or a combination of both?
We don't need an auto-formatter. Just a tool - such a pylint - which runs on our codebase and makes suggestions on how the code should look like. This should make things easier.
> I wish to apply to GSOC as well for the same project. However, since the deadline is today, I will be grateful if you could provide some suggestions for the project.
I see you submitted already
Regards
Lars
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-04-11 11:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-31 9:37 [Outreachy] Interested in contribution: Code Standards Checking using clang-format Ishani
2017-04-03 11:00 ` Lars Kurth
2017-04-03 12:01 ` Ishani
2017-04-03 16:22 ` Lars Kurth
2017-04-11 11:21 ` Ishani [this message]
2017-04-11 11:52 ` Lars Kurth
2017-04-16 20:00 ` Ishani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=214333585.4595284.1491909714711.JavaMail.zimbra@research.iiit.ac.in \
--to=chugh.ishani@research.iiit.ac.in \
--cc=andrew.cooper3@citrix.com \
--cc=cardoe@cardoe.com \
--cc=lars.kurth.xen@gmail.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).