• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

smartsheet / smartsheet-java-sdk / #44

25 Aug 2023 05:39PM UTC coverage: 50.55% (+0.1%) from 50.427%
#44

push

github-actions

web-flow
Fix remaining Checkstyle violations and Enable Checkstyle (#58)

* Fix remaining Checkstyle violations and Enable Checkstyle

We are now down to `20` checkstyle violations in main and `0` violations in test.

The remaining 20 violations are not trivial to fix, so I've set checkstyle to allow those 20 violations to exist, but to fail the build if we ever exceed 20 violations. This should make the build fail if any new violations are added.

For tests, we do not allow _any_ violations. This means adding a single violation will fail the build. Once the 20 violations in main are cleaned up, we can make main and test have the same config.

Note: This MR also changes our PR pipeline to run `./gradlew clean build` instead of `./gradlew clean test`. The reason for this is that build runs all the tests and performs all the other checks (such as checkstyle), whereas `test` didn't run checkstyle and we wouldn't have noticed violations until we tried to deploy.

148 of 148 new or added lines in 24 files covered. (100.0%)

3448 of 6821 relevant lines covered (50.55%)

0.51 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/src/main/java/com/smartsheet/api/internal/json/CellSerializerModifier.java
1
package com.smartsheet.api.internal.json;
2

3
/*
4
 * #[license]
5
 * Smartsheet SDK for Java
6
 * %%
7
 * Copyright (C) 2023 Smartsheet
8
 * %%
9
 * Licensed under the Apache License, Version 2.0 (the "License");
10
 * you may not use this file except in compliance with the License.
11
 * You may obtain a copy of the License at
12
 *
13
 *      http://www.apache.org/licenses/LICENSE-2.0
14
 *
15
 * Unless required by applicable law or agreed to in writing, software
16
 * distributed under the License is distributed on an "AS IS" BASIS,
17
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
 * See the License for the specific language governing permissions and
19
 * limitations under the License.
20
 * %[license]
21
 */
22

23
import com.fasterxml.jackson.databind.BeanDescription;
24
import com.fasterxml.jackson.databind.JsonSerializer;
25
import com.fasterxml.jackson.databind.SerializationConfig;
26
import com.fasterxml.jackson.databind.ser.BeanSerializerModifier;
27
import com.smartsheet.api.models.Cell;
28
import com.smartsheet.api.models.CellLink;
29

30
/**
31
 * If the class being serialized is a cell, pass along the default serializer along to the CellSerializer object.
32
 * We'll special case the linkInFromCell case but pass the rest along to the default serializer.
33
 */
34
public class CellSerializerModifier extends BeanSerializerModifier {
1✔
35
    @Override
36
    public JsonSerializer<?> modifySerializer(SerializationConfig config, BeanDescription beanDesc, JsonSerializer<?> serializer) {
37
        if (beanDesc.getBeanClass() == Cell.class) {
1✔
38
            return new CellSerializer((JsonSerializer<Object>) serializer);
×
39
        } else if (beanDesc.getBeanClass() == CellLink.class) {
1✔
40
            return new CellLinkSerializer((JsonSerializer<Object>) serializer);
×
41
        }
42
        return serializer;
1✔
43
    }
44
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc