influxdata / influxdata/kapacitor

tickfmt readability changes

Open
#937 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2.4k
Forks
479
Avg merge
4d 16h
Merged PRs (30d)
4

Description

I really like the use of tickfmt but I has some questions as to why specific conventions were implemented and if a PR to adjust them would be accepted.

This looks ugly to me, I conceede it is a matter of personal taste but in large tick scripts I would like to see something a little more condensed.

``` javascript
// Datastream
// Define the data that will be acted upon
var db = 'telegraf'

var group = 'host'

var metricType = 'cpu'

var metric = 'usage_steal'

var metricFilter = 'cpu-total'

var rPolicy = 'default'
```

This preserves some of the whitespace but the variables are not spaced out with a newline. IMHO this not only saves additional scrolling of the code but presents the code in a more readable manner.

``` javascript
// Datastream
// Define the data that will be acted upon

var db = 'telegraf'
var group = 'host'
var metricType = 'cpu'
var metric = 'usage_steal'
var metricFilter = 'cpu-total'
var rPolicy = 'default'
```

This

``` javascript
.pagerDuty()
.serviceKey(pagerdutyKey)
```

should be formatted like

``` javascript
.pagerDuty()
.serviceKey(pagerdutyKey)
```

to show the relation to pagerDuty

Contributor guide

Open the contributing guide

Research direction

The issue names tickfmt but no implementation files or tests. Start by locating tickfmt's formatter entry point and current formatting tests, then compare their behavior with both examples. Done means the accepted convention is documented or implemented with regression coverage, and the desired variable alignment and chaining indentation are unambiguous.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, javascript
Domain
tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.