Skip to content

Commit 0aa0e4b

Browse files
authored
CI: new job which fails if a file contains FIXME (#5121)
When working on a big PR, sometimes you have something you know you need to fix before merging. With this CI job, just add a FIXME comment and you'll be forced to address it before all CI can pass. We intentionally allow CI to make tarballs for a commit and publish npm packages even with FIXME, because you may want to test out a build of an incomplete PR. Change existing TODO comments to FIXME. Document this requirement in CONTRIBUTING.md and make the text about PRs with failing tests a bit gentler.
1 parent 9a46598 commit 0aa0e4b

10 files changed

Lines changed: 32 additions & 15 deletions

File tree

.circleci/config.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,24 @@ jobs:
7272
steps:
7373
- common_test_steps
7474

75+
# We make CI fail if any file contains FIX and ME right next to each other.
76+
# This means that when working on a big PR, you can throw in notes that you
77+
# are forced to come back to before merging the PR. Note that we don't block
78+
# the tarball or publish steps on this, since you may want to try out builds
79+
# on branches that still contain unresolved problems. In order for this file
80+
# to not cause this job to fail, we obfuscate the target string by encoding
81+
# the last letter in in hex (\x45 = E).
82+
"Check for FIXM\x45":
83+
docker:
84+
- image: cimg/base:stable
85+
steps:
86+
- add_ssh_keys
87+
- checkout
88+
- run:
89+
name: "Check for FIXM\x45"
90+
# ! means this fails if git grep succeeds, ie if there are any matches
91+
command: "! git grep FIXM\x45"
92+
7593
# XXX We used to use this filter to only run a "Docs" job on docs branches.
7694
# Now we use it to disable all jobs. It's unclear if there's a simpler way
7795
# to do this!
@@ -98,8 +116,6 @@ workflows:
98116
version: 2
99117
Build:
100118
jobs:
101-
# - NodeJS 6:
102-
# <<: *common_non_publish_filters
103119
- NodeJS 8:
104120
<<: *common_non_publish_filters
105121
- NodeJS 10:
@@ -108,6 +124,7 @@ workflows:
108124
<<: *common_non_publish_filters
109125
- NodeJS 14:
110126
<<: *common_non_publish_filters
127+
- "Check for FIXM\x45"
111128
- oss/lerna_tarballs:
112129
name: Package tarballs
113130
<<: *common_non_publish_filters

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ For significant changes to a repository, it’s important to settle on a design
7474

7575
It’s important that every piece of code in Apollo packages is reviewed by at least one core contributor familiar with that codebase. Here are some things we look for:
7676

77-
1. **Required CI checks pass.** This is a prerequisite for the review, and it is the PR author's responsibility. As long as the tests don’t pass, the PR won't get reviewed.
77+
1. **Required CI checks pass.** This is a prerequisite for the review, and it is the PR author's responsibility. As long as the tests don’t pass, the PR won't get merged. If you're having a challenge getting tests to pass, feel free to ask for help. In addition to running tests, CI will fail if you add the words FIX and ME without a space within them in any file; this lets you add comments during the development process that you can't forget to address before merging.
7878
2. **Simplicity.** Is this the simplest way to achieve the intended goal? If there are too many files, redundant functions, or complex lines of code, suggest a simpler way to do the same thing. In particular, avoid implementing an overly general solution when a simple, small, and pragmatic fix will do.
7979
3. **Testing.** Do the tests ensure this code won’t break when other stuff changes around it? When it does break, will the tests added help us identify which part of the library has the problem? Did we cover an appropriate set of edge cases? Look at the test coverage report if there is one. Are all significant code paths in the new code exercised at least once?
8080
4. **No unnecessary or unrelated changes.** PRs shouldn’t come with random formatting changes, especially in unrelated parts of the code. If there is some refactoring that needs to be done, it should be in a separate PR from a bug fix or feature, if possible.

packages/apollo-cache-control/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export enum CacheScope {
2525

2626
export interface CacheControlExtensionOptions {
2727
defaultMaxAge?: number;
28-
// FIXME: We should replace these with
28+
// TODO: We should replace these with
2929
// more appropriately named options.
3030
calculateHttpHeaders?: boolean;
3131
stripFormattedExtensions?: boolean;

packages/apollo-datasource-rest/src/__tests__/RESTDataSource.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ describe('RESTDataSource', () => {
213213
await dataSource.getFoo();
214214

215215
expect(fetch).toBeCalledTimes(1);
216-
// FIXME: request.credentials is not supported by node-fetch
216+
// TODO: request.credentials is not supported by node-fetch
217217
// expect(fetch.mock.calls[0][0].credentials).toEqual('include');
218218
});
219219

packages/apollo-server-cache-memcached/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Memcached from 'memcached';
66
import { promisify } from 'util';
77

88
export class MemcachedCache implements TestableKeyValueCache {
9-
// FIXME: Replace any with proper promisified type
9+
// TODO: Replace any with proper promisified type
1010
readonly client: any;
1111
readonly defaultSetOptions: KeyValueCacheSetOptions = {
1212
ttl: 300,

packages/apollo-server-caching/src/InMemoryLRUCache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function defaultLengthCalculation(item: any) {
1414
export class InMemoryLRUCache<V = string> implements TestableKeyValueCache<V> {
1515
private store: LRUCache<string, V>;
1616

17-
// FIXME: Define reasonable default max size of the cache
17+
// TODO: Define reasonable default max size of the cache
1818
constructor({
1919
maxSize = Infinity,
2020
sizeCalculator = defaultLengthCalculation,

packages/apollo-server-core/src/ApolloServer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1279,7 +1279,7 @@ export class ApolloServerBase {
12791279
if (typeof options.context === 'function') {
12801280
options.context = (options.context as () => never)();
12811281
} else if (typeof options.context === 'object') {
1282-
// FIXME: We currently shallow clone the context for every request,
1282+
// TODO: We currently shallow clone the context for every request,
12831283
// but that's unlikely to be what people want.
12841284
// We allow passing in a function for `context` to ApolloServer,
12851285
// but this only runs once for a batched request (because this is resolved

packages/apollo-server-core/src/requestPipeline.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ export async function processGraphQLRequest<TContext>(
222222
metrics.persistedQueryRegister = true;
223223
}
224224
} else if (query) {
225-
// FIXME: We'll compute the APQ query hash to use as our cache key for
225+
// TODO: We'll compute the APQ query hash to use as our cache key for
226226
// now, but this should be replaced with the new operation ID algorithm.
227227
queryHash = computeQueryHash(query);
228228
} else {
@@ -332,7 +332,7 @@ export async function processGraphQLRequest<TContext>(
332332
}
333333
}
334334

335-
// FIXME: If we want to guarantee an operation has been set when invoking
335+
// TODO: If we want to guarantee an operation has been set when invoking
336336
// `willExecuteOperation` and executionDidStart`, we need to throw an
337337
// error here and not leave this to `buildExecutionContext` in
338338
// `graphql-js`.

packages/apollo-server-core/src/runHttpQuery.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export interface ApolloServerHttpResponse {
4242
}
4343

4444
export interface HttpQueryResponse {
45-
// FIXME: This isn't actually an individual GraphQL response, but the body
45+
// TODO: This isn't actually an individual GraphQL response, but the body
4646
// of the HTTP response, which could contain multiple GraphQL responses
4747
// when using batching.
4848
graphqlResponse: string;
@@ -132,7 +132,7 @@ export async function runHttpQuery(
132132
options.debug = debugDefault;
133133
}
134134

135-
// FIXME: Errors thrown while resolving the context in
135+
// TODO: Errors thrown while resolving the context in
136136
// ApolloServer#graphQLServerOptions are currently converted to
137137
// a throwing function, which we invoke here to rethrow an HTTP error.
138138
// When we refactor the integration between ApolloServer, the middleware and
@@ -168,7 +168,7 @@ export async function runHttpQuery(
168168
executor: options.executor,
169169
fieldResolver: options.fieldResolver,
170170

171-
// FIXME: Use proper option types to ensure this
171+
// TODO: Use proper option types to ensure this
172172
// The cache is guaranteed to be initialized in ApolloServer, and
173173
// cacheControl defaults will also have been set if a boolean argument is
174174
// passed in.
@@ -239,7 +239,7 @@ export async function processHTTPRequest<TContext>(
239239
function buildRequestContext(
240240
request: GraphQLRequest,
241241
): GraphQLRequestContext<TContext> {
242-
// FIXME: We currently shallow clone the context for every request,
242+
// TODO: We currently shallow clone the context for every request,
243243
// but that's unlikely to be what people want.
244244
// We allow passing in a function for `context` to ApolloServer,
245245
// but this only runs once for a batched request (because this is resolved

packages/apollo-server-env/src/index.browser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@ if (!global.process.hrtime) {
4040
}
4141

4242
if (!global.os) {
43-
// FIXME: Add some sensible values
43+
// TODO: Add some sensible values
4444
global.os = {};
4545
}

0 commit comments

Comments
 (0)