Kynetics/uf-android-client

View on GitHub

Showing 23 of 95 total issues

Class CurrentUpdateState has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

// todo refactor
class CurrentUpdateState(context: Context) {

    private val sharedPreferences: SharedPreferences

    Method install has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        override fun install(
            artifact: Updater.SwModuleWithPath.Artifact,
            currentUpdateState: CurrentUpdateState,
            messenger: Updater.Messenger,
            context: Context

      File ABOtaInstaller.kt has 268 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*
       * Copyright © 2017-2023  Kynetics  LLC
       * 
       * This program and the accompanying materials are made
       * available under the terms of the Eclipse Public License 2.0

        Method build has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                fun build(
                    configurationHandler: ConfigurationHandler,
                    mNotificationManager: NotificationManager,
                    service: UpdateFactoryService
                ): AndroidDeploymentPermitProvider {

          Method installationResult has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private fun installationResult(
                  updateStatus: CompletableFuture<Int>,
                  messenger: Updater.Messenger,
                  artifact: Updater.SwModuleWithPath.Artifact
              ): CurrentUpdateState.InstallationResult {

            Method applyUpdate has 42 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                override fun applyUpdate(
                    modules: Set<Updater.SwModuleWithPath>,
                    messenger: Updater.Messenger
                ): Updater.UpdateResult {
                    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {

              Method updatePreference has 41 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private fun updatePreference(preference: Preference?, key: String, sharedPrefs: SharedPreferences) {
                      if (preference == null || preference is SwitchPreferenceCompat) {
                          return
                      }
              
              

                Method install has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    @RequiresApi(Build.VERSION_CODES.LOLLIPOP)
                    override fun install(
                        artifact: Updater.SwModuleWithPath.Artifact,
                        currentUpdateState: CurrentUpdateState,
                        messenger: Updater.Messenger,

                  Method schedule has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      fun schedule(tag:String,
                                   timeWindows: UFServiceConfigurationV2.TimeWindows,
                                   action:()->Unit):Status{
                          with(ExecutionTime.forCron(HaraCronParser.parse(timeWindows.cronExpression))){
                              val now: ZonedDateTime = ZonedDateTime.now()

                    Method onReceive has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        override fun onReceive(context: Context, intent: Intent) {
                            if (PackageInstallerBRHandler.ACTION_INSTALL_COMPLETE != intent.action) {
                                return
                            }
                    
                    

                      Method onStatusUpdate has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                              override fun onStatusUpdate(status: Int, percent: Float) { // i==status  v==percent
                                  Log.d(TAG, "status:$status")
                                  Log.d(TAG, "percent:$percent")
                                  val currentPhaseProgress = min(percent.toDouble(), 100.0)
                                  val newPhase = previousState != status

                        Method init has 10 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            override fun init(haraClientData: HaraClientData,
                                              directoryForArtifactsProvider: DirectoryForArtifactsProvider,
                                              configDataProvider: ConfigDataProvider,
                                              softDeploymentPermitProvider: DeploymentPermitProvider,
                                              messageListeners: List<MessageListener>,

                          Method onCreate has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              override fun onCreate() {
                                  super.onCreate()
                                  AndroidLoggerAdapter.setLogTag("Update Factory Client")
                                  if(BuildConfig.DEBUG){
                                      AndroidLoggerAdapter.setLogLevel(LogLevel.TRACE)

                            Method fromJson has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    /**
                                     * Deserialize a [jsonContent] element into a corresponding object of type [UFServiceMessageV1].
                                     * @throws [SerializationException] if given input can not be deserialized
                                     * @throws [IllegalArgumentException] if given input isn't a UFServiceMessageV1 json serialization
                                     */

                              Method newInstance has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                      fun newInstance(
                                          configurationHandler: ConfigurationHandler,
                                          restartableClientService: RestartableClientService,
                                          softDeploymentPermitProvider: AndroidDeploymentPermitProvider
                                      ) :CommunicationApiStrategy{

                                Method moveSharedPreferences has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    @Suppress("UNCHECKED_CAST")
                                    private fun moveSharedPreferences(sp1:SharedPreferences, sp2:SharedPreferences, moveTo:(Map.Entry<String, Any?>) -> Boolean){
                                        sp2.edit().apply{
                                            val sp1Editor = sp1.edit()
                                            sp1.all.filter(moveTo).forEach{ entry ->

                                  Method intercept has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      @Throws(IOException::class)
                                      override fun intercept(chain: Interceptor.Chain): Response {
                                          val originalRequest = chain.request()
                                          val builder = originalRequest.newBuilder()
                                          val isConfigDataRequest = originalRequest.url.toString().endsWith(CONFIG_DATA_ACTION)

                                    Method newUFClient has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                            haraClientData: HaraClientData,
                                            directoryForArtifactsProvider: DirectoryForArtifactsProvider,
                                            configDataProvider: ConfigDataProvider,
                                            deploymentPermitProvider: DeploymentPermitProvider,
                                            messageListeners: List<MessageListener>,

                                      Method newInstance has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                              haraClientData: HaraClientData,
                                              directoryForArtifactsProvider: DirectoryForArtifactsProvider,
                                              configDataProvider: ConfigDataProvider,
                                              deploymentPermitProvider: DeploymentPermitProvider,
                                              messageListeners: List<MessageListener>,

                                        Method newHawkbitClient has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                        Open

                                                haraClientData: HaraClientData,
                                                directoryForArtifactsProvider: DirectoryForArtifactsProvider,
                                                configDataProvider: ConfigDataProvider,
                                                deploymentPermitProvider: DeploymentPermitProvider,
                                                messageListeners: List<MessageListener>,
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language