Skip to content

Commit

Permalink
Fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Nov 28, 2021
1 parent 23e8f79 commit 60a0b9b
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
10 changes: 5 additions & 5 deletions src/history/data/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { loadRawResults } from '../normalize/load.js'

import { addRawResult, removeRawResult, listRawResults } from './results.js'

// Save results so they can be compared or shown later.
// Save rawResults so they can be compared or shown later.
// We do not save stopped benchmarks.
export const addToHistory = async function (rawResult, { save, cwd }) {
if (!save) {
Expand All @@ -20,7 +20,7 @@ export const addToHistory = async function (rawResult, { save, cwd }) {
await addRawResult(rawResultA, cwd)
}

// Remove a result
// Remove a rawResult
export const removeFromHistory = async function ({ id }, { cwd, force }) {
if (!(await shouldRemoveFromHistory(force))) {
return
Expand All @@ -40,17 +40,17 @@ const shouldRemoveFromHistory = async function (force) {
return confirmed
}

// Get a previous result by delta
// Get a previous rawResult by delta
export const getFromHistory = async function (config) {
const rawResults = await listHistory(config)
const { rawResult, previous } = await listResultsByDelta(rawResults, config)
return { rawResult, previous }
}

// List, sort, filter and normalize all results
// List, sort, filter and normalize all rawResults
// This is performed at the beginning of all commands because this allows:
// - Failing fast if there is a problem with the history
// - Including previous|diff in results preview
// - Including previous|diff in rawResults preview
export const listHistory = async function ({ cwd, select }) {
const rawResults = await listRawResults(cwd)
const rawResultsA = loadRawResults(rawResults, select)
Expand Down
4 changes: 2 additions & 2 deletions src/history/delta/formats/commit.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ const parseCommit = function (delta) {
// Git commit hash at least 7 characters long
const GIT_COMMIT_REGEXP = /^[\da-f]{7,}$/iu

// If several results match, we use the most recent one because this is what
// If several rawResults match, we use the most recent one because this is what
// users most likely want.
// When none is found in `result.systems`, we try to use `git` instead.
// When none is found in `rawResult.systems`, we try to use `git` instead.
const findByCommit = async function (rawResults, commit, cwd) {
const index = findIndexReverse(rawResults, ({ systems: [{ git = {} }] }) =>
git.commit.startsWith(commit),
Expand Down
4 changes: 2 additions & 2 deletions src/history/delta/formats/count.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { UserError } from '../../../error/main.js'

// Delta can be an integer, to find the {integer}-th last result.
// Default deltas are 1, i.e. last result.
// Delta can be an integer, to find the {integer}-th last rawResult.
// Default deltas are 1, i.e. last rawResult.
const parseCount = function (delta) {
if (typeof delta !== 'number') {
return
Expand Down
2 changes: 1 addition & 1 deletion src/history/delta/formats/first.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Delta can be "first" to compare with the least recent result.
// Delta can be "first" to compare with the least recent rawResult.
const parseFirst = function (delta) {
if (delta !== FIRST_DELTA) {
return
Expand Down
6 changes: 3 additions & 3 deletions src/history/delta/formats/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { execa } from 'execa'

import { UserError } from '../../../error/main.js'

// Find a result by git reference (commit/branch/tag).
export const findByGitRef = async function (results, gitRef, cwd) {
// Find a rawResult by git reference (commit/branch/tag).
export const findByGitRef = async function (rawResults, gitRef, cwd) {
const { stdout, stderr, message, failed } = await execa(
'git',
[
Expand All @@ -21,7 +21,7 @@ export const findByGitRef = async function (results, gitRef, cwd) {
const timestamp = Number(stdout) * SECS_TO_MSECS
checkTimestamp({ timestamp, stderr, message, failed, cwd })

return results.findIndex((result) => result.timestamp >= timestamp)
return rawResults.findIndex((rawResult) => rawResult.timestamp >= timestamp)
}

const SECS_TO_MSECS = 1e3
Expand Down
2 changes: 1 addition & 1 deletion src/history/delta/formats/id.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { validate as isUuid } from 'uuid'

// Deltas can be the `result.id`
// Deltas can be the `rawResult.id`
const parseId = function (delta) {
if (!isUuid(delta)) {
return
Expand Down
4 changes: 2 additions & 2 deletions src/history/delta/formats/tag.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ const parseTag = function (delta) {
return delta
}

// If several results match, we use the most recent one because this is what
// If several rawResults match, we use the most recent one because this is what
// users most likely want.
// When none is found in `result.systems`, we try to use `git` instead.
// When none is found in `rawResult.systems`, we try to use `git` instead.
const findByTag = async function (rawResults, tagOrBranch, cwd) {
const index = findIndexReverse(
rawResults,
Expand Down
2 changes: 1 addition & 1 deletion src/run/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { listCombinations } from '../combination/list/main.js'
import { listHistory } from '../history/data/main.js'
import { createSystemInfo } from '../system/create/main.js'

// Create a new result to measure
// Create a new rawResult to measure
export const createResult = async function (config) {
const [combinations, previous] = await Promise.all([
listCombinations(config),
Expand Down

0 comments on commit 60a0b9b

Please sign in to comment.