1. Two spaces indentation
2. Comments
New:
# The comment
Old:
# The comment
3. Whitespace should be used to split up the code, not random
4. Lining up and spacing
4.a spaces between variables and equals
4.b lining up
New:
@task_data = WorkItem.find_by_sql(str_task)
@project_data = WorkItem.find_by_sql(str_project)
Old:
@task_data=WorkItem.find_by_sql(str_task)
@project_data=WorkItem.find_by_sql(str_project)
5. use #{}
instead of escpaing out
= '" + @day_info.original_id.to_s + "' group
6. Don't commit large blocks of commented code (i.e. daicens version)
7. Case statments use
case
when "bla" then something
when "bla2" then something_else
else "something"
end
or
case
when "bla"
then something
when "else"
then something
8. Don't explicitly use "return" unless you need it
i.e.
new:
def bla
whatever
end
old:
def bla
return whatever
end
9. format your blocks
instead of
new_object.delete_if{|key,value|(key=='id')||(key=='revision')||(key=='lastModifiedByClient')||(key=='regularTime')||(key=='hasWorkItems')||(key=='hasInvalidWorkItems')||(key=='hasTags')}
2. Comments
New:
# The comment
Old:
# The comment
3. Whitespace should be used to split up the code, not random
4. Lining up and spacing
4.a spaces between variables and equals
4.b lining up
New:
@task_data = WorkItem.find_by_sql(str_task)
@project_data = WorkItem.find_by_sql(str_project)
Old:
@task_data=WorkItem.find_by_sql(str_task)
@project_data=WorkItem.find_by_sql(str_project)
5. use #{}
instead of escpaing out
= '" + @day_info.original_id.to_s + "' group
6. Don't commit large blocks of commented code (i.e. daicens version)
7. Case statments use
case
when "bla" then something
when "bla2" then something_else
else "something"
end
or
case
when "bla"
then something
when "else"
then something
8. Don't explicitly use "return" unless you need it
i.e.
new:
def bla
whatever
end
old:
def bla
return whatever
end
9. format your blocks
instead of
new_object.delete_if{|key,value|(key=='id')||(key=='revision')||(key=='lastModifiedByClient')||(key=='regularTime')||(key=='hasWorkItems')||(key=='hasInvalidWorkItems')||(key=='hasTags')}