Skip to content

Refine audit:code ordering #7

@joshpencheon

Description

@joshpencheon

The intention is that show_in_priority=true can be passed to rake audit:code, which should output files ordered such that those which have the oldest unreviewed code appear first.

However, I'm not sure that it is working as intended. Current implementation:

https://github.com/PublicHealthEngland/ndr_dev_support/blob/master/lib/tasks/audit_code.rake#L87-L92

We should be ordering files by:

  • if the file has not been reviewed before, the revision the file was added to the repository, or
  • if the file has been reviewed before, the revision that the file was last flagged as safe (safe_revision), and not the last_changed_rev (which might be misleadingly-recent for files that are touched regularly).

This may still not be perfect.

In [git-]svn, revisions are numeric and therefore orderable. In pure git, commits are identified by a digest. Some derivable orderings:

# returns 'n' , when <<SHA>> is for the n-th commit on the current branch
$ git rev-list --count <<SHA>>

# returns the commit date of <<SHA>>
$ git show -s --format=%ci HEAD~10

Other potentially-useful commands:

# In git-svn, the revision that added <<FILE>>:
$ git svn log --oneline --reverse --limit 1 <<FILE>> | cut -d\| -f1

# In svn, the revision that added <<FILE>>:
$ svn log -r 1:HEAD --limit 1 -q <<FILE>> | grep -v '^-' | cut -d' ' -f1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions