[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [Outreachy] Interested in contribution: Code Standards Checking using clang-format
Hello, 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. 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. 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). At present, I am working on creating a clang format file supporting subset of coding formats for Xen Hypervisor. Can you provide me with some more insight into the project? 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. 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? 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. Regards, Ishani ----- Original Message ----- From: "Lars Kurth" <lars.kurth.xen@xxxxxxxxx> To: "Ishani" <chugh.ishani@xxxxxxxxxxxxxxxxxxx> Cc: "cardoe" <cardoe@xxxxxxxxxx>, "xen-devel" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Andrew Cooper" <andrew.cooper3@xxxxxxxxxx> Sent: Monday, April 3, 2017 4:30:11 PM Subject: Re: [Xen-devel] [Outreachy] Interested in contribution: Code Standards Checking using clang-format Hi Ishani, (+Doug, +Andy) not that the deadline as been extended to April 13. I am also CC'ing Andy Cooper as Doug has not responded. The challenge that we will have is to satisfy the small task requirement while also making the task sensible in the context of the project. Now we do have some flexibility there: in other words, we can declare for example an RFC that everyone agrees with as such a contribution. But as a basic idea, the first step of the project would be to try and come up with a .clang-format file that matches one of the coding styles in the git tree (either http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=CODING_STYLE or http://xenbits.xen.org/gitweb/?p=xen.git;a=blob;f=tools/libxl/CODING_STYLE) and prove that it works. I don't know whether this is doable as a small task: the number of options in clang-format do not seem to be huge. And there are tools such as https://clangformat.com/ to experiment with. If it is possible to do the whole thing in a small task, the output would be a .clang-format file that is submitted for code review to a suitable location in the xen tree. I don't know what the right location should be, but xen.git:tools/clang-format would be sensible. If it is not possible to do this for one of the complete coding standards, I would develop for one or two subsets: 1: a .clang-format settings snippet for a reasonably complex coding style pattern in the coding standard 2: a piece of test code that adheres to the coding standard 3: a variant of the same code snippet that does not adhere to the coding standard 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. Again this could go into xen.git:tools/clang-format - maybe under tools/clang-format/tests for now @Andy, @Doug: does this sound sensible? Regards Lars > On 31 Mar 2017, at 10:37, Ishani <chugh.ishani@xxxxxxxxxxxxxxxxxxx> wrote: > > Hello Sir, > > I am Ishani Chugh, a fourth year undergraduate student of Electronics and > Communications Engineering at International Institute of Information > Technology, Hyderabad. I am passionate about Open Source Development. I am > interested to contribute to your organization Xen Project as an Outreachy > intern . I am interested to work in the project: Code Standards Checking > using clang-format. I am proficient in C++ and have slight experience of > working in clang-format. > Please guide me for initial contributions to prove my candidature. > > Regards > Ishani > > _______________________________________________ > Xen-devel mailing list > Xen-devel@xxxxxxxxxxxxx > https://lists.xen.org/xen-devel _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |