Wiki

Changes between Initial Version and Version 1 of HowToSubmitAPatch

Show
Ignore:
Timestamp:
05/03/08 22:19:04 (17 years ago)
Author:
Chuck
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HowToSubmitAPatch

    v1 v1  
     1= Introduction = 
     2 
     3Submitting a patch in a great way to contribute to Cobra. In order that patches can be applied in a timely manner, please follow these guidelines. Doing so eases the burden for those applying patches, gets your patches in faster and reduces the "apply patch" bottleneck. 
     4 
     5Discuss the patch on the [http://cobra-language.com/forums/ forums] to see what others think, find out if there is already work in progress, etc. 
     6 
     7= Coding = 
     8 
     9See !ImplementationNotes.text in the Developer directory next door to the Source directory for information about the implementation of Cobra, how to run the test suite, etc. 
     10 
     11Cobra supports both tabs and spaces for indentation, but the implementation of Cobra uses all tabs. Regardless of your particular religious views in this matter (or allegedly rational views), please "go with the flow" and use tabs like the rest of the implementation. Of course, in your own projects, feel free to use either or both (though not in the same line). 
     12 
     13Cobra itself enforces some coding guidelines such as capitalizing classes and indenting code blocks. Additionally, try to mimic the style of code that you see around the code are writing. Here are some additional coding guidelines: 
     14{{{ 
     15# Calling methods: No space after '(' or before ')'. One space after commas. 
     16# good: 
     17foo.bar(x, y) 
     18# bad: 
     19foo.bar(x,y) 
     20foo.bar( x, y) 
     21foo.bar(x, y ) 
     22foo.bar( x, y ) 
     23 
     24# A space before and after most binary operators most of the time. 
     25# good: 
     26x = 1 
     27# bad: 
     28a= 1 
     29b =2 
     30c=3 
     31 
     32# No extraneous parens for simple expressions: 
     33# good: 
     34ensure 
     35    result in [8, 16, 32, 64] 
     36# bad: 
     37ensure 
     38    (result) in [8, 16, 32, 64] 
     39}}} 
     40 
     41Update !IntermediateReleaseNotes.text in the Developer directory next door to the Source directory. Include your name or forum/Trac handle for credit. 
     42 
     43Be sure to add or update tests found in the Tests directory next door to the Source directory. You may wish to run the test suite ''before'' making your changes in order to see if there are any failures independent of them. You must run the test suite after your final changes to be sure nothing has been broken by them. 
     44 
     45Do not use print statements in tests. Use assert statements. 
     46{{{ 
     47# good: 
     48assert x inherits Foo 
     49# bad: 
     50print 'x type =', x.getType 
     51}}} 
     52 
     53If you have old, commented out code that is no longer relevant due to the patch, delete it. The patch "diff" itself will show the old code and we can always retrieve it from the source code control system if we need it at a later date. Also, remove stray {{{print}}} and {{{trace}}} statements used for debugging. 
     54 
     55After testing, if you make any small tweaks to your code, please run the test suite again. You never know what's going to break. 
     56 
     57= Submission = 
     58 
     59Example: 
     60{{{ 
     61cd CobraWorkspace 
     62svn add Tests/110-basics-two/520-blah-blah.cobra 
     63svn di > FixSomething.patch 
     64}}} 
     65 
     66A typical patch has changes to files in Source, files in Tests and the !IntermediateReleaseNotes.text file. Please submit the patch as being rooted in the workspace directory (not in the Source subdirectory or elsewhere). This directory contains the subdirectories Source, Tests, etc. 
     67 
     68Use "svn add" on new files to get them to show up in the patch. 
     69 
     70Submit the patch as one file which contains all changes. If later, you make additional changes, resubmit the entire patch. 
     71 
     72Use ".patch" for the extension and otherwise, name the file as you like. 
     73 
     74Attach the patch to a ticket instead of the forums so that it doesn't get "lost". If there was a forum discussion on the topic of the patch, you can always post a link to the ticket in the discussion.