Skip to content

Commit

Permalink
- Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
daksh7011 committed Mar 2, 2024
1 parent c701ea9 commit 48eeae8
Show file tree
Hide file tree
Showing 20 changed files with 153 additions and 56 deletions.
97 changes: 97 additions & 0 deletions app/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
root = true

[*]
ij_continuation_indent_size = 8
ij_formatter_off_tag = @formatter:off
ij_formatter_on_tag = @formatter:on
ij_formatter_tags_enabled = true
ij_smart_tabs = false
ij_wrap_on_typing = false

[{*.kt,*.kts}]
ij_kotlin_align_in_columns_case_branch = false
ij_kotlin_align_multiline_binary_operation = false
ij_kotlin_align_multiline_extends_list = false
ij_kotlin_align_multiline_method_parentheses = false
ij_kotlin_align_multiline_parameters = true
ij_kotlin_align_multiline_parameters_in_calls = false
ij_kotlin_allow_trailing_comma = false
ij_kotlin_allow_trailing_comma_on_call_site = false
ij_kotlin_assignment_wrap = normal
ij_kotlin_blank_lines_after_class_header = 0
ij_kotlin_blank_lines_around_block_when_branches = 0
ij_kotlin_blank_lines_before_declaration_with_comment_or_annotation_on_separate_line = 1
ij_kotlin_block_comment_add_space = false
ij_kotlin_block_comment_at_first_column = true
ij_kotlin_call_parameters_new_line_after_left_paren = true
ij_kotlin_call_parameters_right_paren_on_new_line = true
ij_kotlin_call_parameters_wrap = on_every_item
ij_kotlin_catch_on_new_line = false
ij_kotlin_class_annotation_wrap = split_into_lines
ij_kotlin_code_style_defaults = KOTLIN_OFFICIAL
ij_kotlin_continuation_indent_for_chained_calls = false
ij_kotlin_continuation_indent_for_expression_bodies = false
ij_kotlin_continuation_indent_in_argument_lists = false
ij_kotlin_continuation_indent_in_elvis = false
ij_kotlin_continuation_indent_in_if_conditions = false
ij_kotlin_continuation_indent_in_parameter_lists = false
ij_kotlin_continuation_indent_in_supertype_lists = false
ij_kotlin_else_on_new_line = false
ij_kotlin_enum_constants_wrap = off
ij_kotlin_extends_list_wrap = normal
ij_kotlin_field_annotation_wrap = split_into_lines
ij_kotlin_finally_on_new_line = false
ij_kotlin_if_rparen_on_new_line = true
ij_kotlin_import_nested_classes = false
ij_kotlin_imports_layout = *,java.**,javax.**,kotlin.**,^
ij_kotlin_insert_whitespaces_in_simple_one_line_method = true
ij_kotlin_keep_blank_lines_before_right_brace = 2
ij_kotlin_keep_blank_lines_in_code = 2
ij_kotlin_keep_blank_lines_in_declarations = 2
ij_kotlin_keep_first_column_comment = true
ij_kotlin_keep_indents_on_empty_lines = false
ij_kotlin_keep_line_breaks = true
ij_kotlin_lbrace_on_next_line = false
ij_kotlin_line_break_after_multiline_when_entry = true
ij_kotlin_line_comment_add_space = false
ij_kotlin_line_comment_add_space_on_reformat = false
ij_kotlin_line_comment_at_first_column = true
ij_kotlin_method_annotation_wrap = split_into_lines
ij_kotlin_method_call_chain_wrap = normal
ij_kotlin_method_parameters_new_line_after_left_paren = true
ij_kotlin_method_parameters_right_paren_on_new_line = true
ij_kotlin_method_parameters_wrap = on_every_item
ij_kotlin_name_count_to_use_star_import = 2147483647
ij_kotlin_name_count_to_use_star_import_for_members = 2147483647
ij_kotlin_parameter_annotation_wrap = off
ij_kotlin_space_after_comma = true
ij_kotlin_space_after_extend_colon = true
ij_kotlin_space_after_type_colon = true
ij_kotlin_space_before_catch_parentheses = true
ij_kotlin_space_before_comma = false
ij_kotlin_space_before_extend_colon = true
ij_kotlin_space_before_for_parentheses = true
ij_kotlin_space_before_if_parentheses = true
ij_kotlin_space_before_lambda_arrow = true
ij_kotlin_space_before_type_colon = false
ij_kotlin_space_before_when_parentheses = true
ij_kotlin_space_before_while_parentheses = true
ij_kotlin_spaces_around_additive_operators = true
ij_kotlin_spaces_around_assignment_operators = true
ij_kotlin_spaces_around_equality_operators = true
ij_kotlin_spaces_around_function_type_arrow = true
ij_kotlin_spaces_around_logical_operators = true
ij_kotlin_spaces_around_multiplicative_operators = true
ij_kotlin_spaces_around_range = false
ij_kotlin_spaces_around_relational_operators = true
ij_kotlin_spaces_around_unary_operator = false
ij_kotlin_spaces_around_when_arrow = true
ij_kotlin_use_custom_formatting_for_modifiers = true
ij_kotlin_variable_annotation_wrap = off
ij_kotlin_while_on_new_line = false
ij_kotlin_wrap_elvis_expressions = 1
ij_kotlin_wrap_expression_body_functions = 1
ij_kotlin_wrap_first_method_in_call_chain = false

ktlint_standard_package-name = disabled
ktlint_standard_property-naming = disabled
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ android {
}
}

flavorDimensions = ["IpScanner"]
flavorDimensions = ["IpScanner"]
productFlavors {
dev {
dimension "IpScanner"
Expand Down
20 changes: 10 additions & 10 deletions app/src/androidTest/java/in/technowolf/ipscanner/ui/SanityTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ class SanityTest {
childAtPosition(
childAtPosition(
withId(R.id.tilIpAddress),
0,
0
),
1,
1
),
isDisplayed(),
),
isDisplayed()
)
)
val fabFetch =
onView(
Expand All @@ -57,13 +57,13 @@ class SanityTest {
withId(R.id.container),
childAtPosition(
withId(android.R.id.content),
0,
),
0
)
),
2,
2
),
isDisplayed(),
),
isDisplayed()
)
)

sleep(3000)
Expand Down Expand Up @@ -91,7 +91,7 @@ class SanityTest {

private fun childAtPosition(
parentMatcher: Matcher<View>,
position: Int,
position: Int
): Matcher<View> {
return object : TypeSafeMatcher<View>() {
override fun describeTo(description: Description) {
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/in/technowolf/ipscanner/IpScanner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ class IpScanner : Application() {
repoModule,
viewModelModule,
appModule,
databaseModule,
),
databaseModule
)
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import `in`.technowolf.ipscanner.data.local.IpDetailsEntity

@Database(
entities = [
IpDetailsEntity::class,
IpDetailsEntity::class
],
version = 1,
exportSchema = true,
exportSchema = true
)
abstract class IpScannerDatabase : RoomDatabase() {
abstract fun getIpDetailsDao(): IpDetailsDao
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ data class IpDetailsEntity(
val asnName: String?,
@PrimaryKey
val ipAddress: String,
val message: String? = null,
val message: String? = null
) {
fun toIpDetailRS() =
IpDetailRS(
Expand All @@ -39,6 +39,6 @@ data class IpDetailsEntity(
org,
asnName,
ipAddress,
message,
message
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ data class IpDetailRS(
@Json(name = "query")
val ipAddress: String,
@Json(name = "message")
val message: String? = null,
val message: String? = null
) {
fun toIpDetailsEntity() =
IpDetailsEntity(
Expand All @@ -55,6 +55,6 @@ data class IpDetailRS(
org,
asnName,
ipAddress,
message,
message
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ import retrofit2.http.Path
interface IpScannerService {
@GET("ip/{ip}")
suspend fun getIpDetails(
@Path("ip") ipAddress: String,
@Path("ip") ipAddress: String
): Response<IpDetailRS>
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ interface PublicIpService {
@JsonClass(generateAdapter = true)
data class PublicIpRS(
@Json(name = "ip")
val ip: String,
val ip: String
)
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ fun okHttpProvider(chuckerInterceptor: ChuckerInterceptor): OkHttpClient {

fun retrofitProvider(
okHttpClient: OkHttpClient,
baseUrl: String,
baseUrl: String
): Retrofit {
return Retrofit.Builder()
.baseUrl(baseUrl)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class AboutActivity : AppCompatActivity() {

private fun launchBrowserWithUrl(
url: String,
isPlayStoreLink: Boolean = false,
isPlayStoreLink: Boolean = false
) {
if (isPlayStoreLink.not()) {
Intent(Intent.ACTION_VIEW).apply {
Expand All @@ -68,15 +68,15 @@ class AboutActivity : AppCompatActivity() {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse("market://details?id=$packageName"),
),
Uri.parse("market://details?id=$packageName")
)
)
} catch (e: ActivityNotFoundException) {
startActivity(
Intent(
Intent.ACTION_VIEW,
Uri.parse("https://play.google.com/store/apps/details?id=$packageName"),
),
Uri.parse("https://play.google.com/store/apps/details?id=$packageName")
)
)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class IpDetailsView
constructor(
context: Context,
private val attrs: AttributeSet? = null,
private val defStyleAttr: Int = 0,
private val defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {
private val binding: IpDetailsViewBinding =
IpDetailsViewBinding.inflate(LayoutInflater.from(context), this, true)
Expand Down Expand Up @@ -50,7 +50,7 @@ class IpDetailsView
attrs,
R.styleable.IpDetailsView,
defStyleAttr,
0,
0
)

titleText = typedArray.getString(R.styleable.IpDetailsView_titleText).orEmpty()
Expand All @@ -74,7 +74,7 @@ class IpDetailsView
fun setValuesToView(
titleText: String,
contentText: String,
@DrawableRes drawableInt: Int = 0,
@DrawableRes drawableInt: Int = 0
) {
this.titleText = titleText
this.contentText = contentText
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class LabelValueView
constructor(
context: Context,
private val attrs: AttributeSet? = null,
private val defStyleAttr: Int = 0,
private val defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr) {
private val binding: LabelValueViewBinding =
LabelValueViewBinding.inflate(LayoutInflater.from(context), this, true)
Expand Down Expand Up @@ -53,7 +53,7 @@ class LabelValueView
attrs,
R.styleable.LabelValueView,
defStyleAttr,
0,
0
)

labelText = typedArray.getString(R.styleable.LabelValueView_labelText).orEmpty()
Expand Down Expand Up @@ -93,7 +93,7 @@ class LabelValueView

@Suppress("unused")
fun setStartImage(
@DrawableRes startImageSrc: Int,
@DrawableRes startImageSrc: Int
) {
this.startImageSrc = startImageSrc
binding.ivStartIcon.setImageDrawable(ContextCompat.getDrawable(context, startImageSrc))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class HomeActivity : AppCompatActivity() {
if (it.message.isNullOrEmpty().not()) {
binding.root.snackBar(
"${it.ipAddress} is ${it.message?.capitalize()}",
anchorView = binding.fabFetchDetails,
anchorView = binding.fabFetchDetails
) {}
showViews(hide = true)
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import kotlinx.coroutines.launch
class HomeViewModel(
private val ipScannerService: IpScannerService,
private val publicIpService: PublicIpService,
private val ipDetailsDao: IpDetailsDao,
private val ipDetailsDao: IpDetailsDao
) : ViewModel() {
private val _ipDetail: MutableLiveData<IpDetailRS?> = MutableLiveData()
val ipDetails = _ipDetail.readOnly()
Expand All @@ -36,7 +36,7 @@ class HomeViewModel(
},
{
_errorLiveData.value = it.localizedMessage
},
}
)
} else {
_ipDetail.value = retrieveIpDetails(ipAddress)
Expand Down Expand Up @@ -66,7 +66,7 @@ class HomeViewModel(
},
{
_errorLiveData.value = it.localizedMessage
},
}
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SettingsActivity : AppCompatActivity() {
class SettingsFragment : PreferenceFragmentCompat() {
override fun onCreatePreferences(
savedInstanceState: Bundle?,
rootKey: String?,
rootKey: String?
) {
setPreferencesFromResource(R.xml.settings_screen_preferences, rootKey)
}
Expand Down
Loading

0 comments on commit 48eeae8

Please sign in to comment.