Complete replacement is the sure bet. I wish there were a single answer - but corrosion is not so simple. The ends (battery and alternator) should be at highest risk from water and salt exposure, but there's the splice for the starter too. And water wicks into the cable, so the corrosion can be deep in the cable - not as common, but it happens.
I just swapped in a good (as least pretty good) used positive cable for one daughter's car because there was melted insulation at the alternator end when I did a different repair. No starting problem yet, but the melted insulation indicated that there was high resistance / heat there. That cable end looked fine two years ago when I did other work including alternator replacement (I had the subframe out, so it was the best time). I'm in Minnesota with winter salt, the car is 13 years old, and these positive battery cables are a known trouble spot - so this was unpleasant to see but not a shocker.
I am going to see about cost of building a new cable using the old cable as a template - but a new one for $130 plus shipping might be just as cheap.